Hello people!
I was just wondering if any of you guys have any easy code that I can use in my game.
I learned from the tutorial that Mr.Tom about Advanced Path Finding made but It doesn't work with the .SWF exporter (Lucky I noticed that before I really started to work on it)
I just want the characters to move inside the house without getting stuck on the wall outside
The two simplest solutions are to put two detectors on the sprites, almost like antennae on an ant. One goes out in front from the player diagonally to the left, and the other to the right. If one of those antennae touches a backdrop or active obstacle, then it rotates the player the opposite direction. You can also put other detectors in choke points, such as the door way, that does the opposite of a backdrop when the antennae touches it. In other words if the left antennae touches a backdrop, the player turns right, if that same antennae touches a door detector, the player will turn to the left.
The other option is to simply not create a situation where path finding is needed.
/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/
That Really Hot Chick
now on the Xbox Live Marketplace!
Another method is to just have him teleport if he hits a wall. This method is a lot easier, but may not look that good, depending on what you are going for. A lot of professionally made games just have a character who is following you teleport.
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.
Most of the time those games will only do it if the controlling character leaves the screen. Moving around close quarters like this might look really bad, but it could work if no other solutions work. Plus that might not account for characters that aren't following the player, and with them you arise the issue of if they teleport, where do they go?
I forgot to mention in my first post, there needs to be a target object. If that character selects that target object, it will always look towards it.
/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/
That Really Hot Chick
now on the Xbox Live Marketplace!