Author Topic: Platformer Pathfinding  (Read 1224 times)

rolandinho

  • Member
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
    • My Portfolio
Platformer Pathfinding
« on: Thu, Oct 14, 2010 »
Hi,

i'm working on a game in which the main character is followed by an other character. There are platforms and obstacles, so the follower has to jump and run to reach the main character.

I've got the basic movement working but it's all based on hit areas so the follower nows when he has to jump. So not very dynamic.

Has anyone made something similar and can share his thoughts!?

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Platformer Pathfinding
« Reply #1 on: Thu, Oct 14, 2010 »
If the follower should match what the player has done, then I'd use a breadcrumb trail effect. When the player moves / performs a key action (like jump) then you write it to a queue which the follower reads from and then duplicates the actions. Like dropping breadcrumbs.
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

rolandinho

  • Member
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
    • My Portfolio
Re: Platformer Pathfinding
« Reply #2 on: Thu, Oct 14, 2010 »
thats a good idea. had that thought too, but i've never done something like that before. I need some time to try it out!

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Platformer Pathfinding
« Reply #3 on: Thu, Oct 14, 2010 »
The key will be to not write to the queue THAT often. You'll always need key events of course (jump, shoot?) but for simple coordinates you could just drop x/y coords every 250ms for example, and then tween between them.
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

rolandinho

  • Member
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
    • My Portfolio
Re: Platformer Pathfinding
« Reply #4 on: Thu, Oct 14, 2010 »
i'll try that tonight! Thanks!