do an object follows the player

  • Hi guys I'm making a platform game who the player is followed by its dog. How can I do that seems naturally? I don't want to do the animation in the same sprite to the dog falls down when it's out of the edge.

    Thanks a lot and sorry if I have write at the wrong place. Beginner! =]

  • That is very simple.

    Create a dog with its own sprite, animation and ect. Give the dog platform behavior.

    Then do this

    1) Dog -> compare X -> Less or equal then Player X -> simulate control RIGHT

    2) Dog -> compare X -> Greater or equal then Player X -> simulate control Left

    So, now when the dog is located not at the same spot on X coordinate with the player, it will move until it gets him

  • P.S. If there are going to be any obstacles on the dog`s way try this.

    1) Dog on collision with "Sprite obstacle" -> Dog simulate control JUMP.

    So the dog will jump over the solid obstacles.

  • P.P.S.

    Dont forget to add Set MIRRORED (for left) AND NOT MIRRORED (for rigth). So the dog will always turn its had to the player.

  • Perfect! I was really stuck in the dog's jump. Thanks a lot AlexeyMak. I'm trying right now.

  • Depending on how complex your obstacles are, that could get messed up in a hurry. It'll do for simple stuff though. The alternative would be developing full AI and pathfinding... which is pretty tough for a platformer. Trust me. <img src="smileys/smiley5.gif" border="0" align="middle" />

  • Also, if it's a really simple game, you can use the rope style of pin.

  • quick and dirty way platformFollower.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Guys, I've tried with "pin" and the result was very nice then I tried "simulate control" and the result was awesome!!!! The dog seems free and then it comes back to the player. I've tried the Yann link too, but seems his construc version is most new than mine, so I can't open his link. Thanks all for help and soon that I can I'm gonna post my game with scirra construct for you. It's getting very nice.

  • my version is the last stable release, you should pick it up (:

    http://www.scirra.com/construct2/releases/r103.2

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)