The Daily Click ::. Forums ::. Klik Coding Help ::. Path finding in Flash games?
 

Post Reply  Post Oekaki 
 

Posted By Message

Fredrik Ortmon



Registered
  10/03/2006
Points
  219

Game of the Week Winner
1st January, 2011 at 21:03:23 -

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)

Image
I just want the characters to move inside the house without getting stuck on the wall outside

Thanks!


Edited by Fredrik Ortmon

 
yo

HorrendousGames

Sourpuss

Registered
  31/10/2009
Points
  481

VIP MemberEvil klikerGame Of The Week Winner
2nd January, 2011 at 01:48:55 -

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!

http://marketplace.xbox.com/en-US/Product/That-Really-Hot-Chick/66acd000-77fe-1000-9115-d80258550942

http://www.create-games.com/project.asp?view=main&id=2160

monkeytherat

Hero of Time Jr

Registered
  07/11/2010
Points
  1293

VIP MemberI donated an open source project
2nd January, 2011 at 02:16:29 -

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.

HorrendousGames

Sourpuss

Registered
  31/10/2009
Points
  481

VIP MemberEvil klikerGame Of The Week Winner
2nd January, 2011 at 06:31:07 -

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!

http://marketplace.xbox.com/en-US/Product/That-Really-Hot-Chick/66acd000-77fe-1000-9115-d80258550942

http://www.create-games.com/project.asp?view=main&id=2160

Fredrik Ortmon



Registered
  10/03/2006
Points
  219

Game of the Week Winner
2nd January, 2011 at 10:59:42 -

Thanks again!
IŽll try the both alternatives

Tell you guys later which worked the best


 
yo

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
2nd January, 2011 at 14:54:02 -

You can download wargame object, it works in flash and has pathfinding.

 
Code me a sausage!

Fredrik Ortmon



Registered
  10/03/2006
Points
  219

Game of the Week Winner
2nd January, 2011 at 23:05:30 -

I went with the teleport solution, looks kinda funny but both the characters and the zombies find their way in now

Thanks guys!

 
yo

monkeytherat

Hero of Time Jr

Registered
  07/11/2010
Points
  1293

VIP MemberI donated an open source project
2nd January, 2011 at 23:15:37 -

No problem, an goodluck with your game

 
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.
   

Post Reply



 



Advertisement

Worth A Click