Zombie follow the Player

0 favourites
  • 5 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hey all.

    I'm making a 2d sidescroller with construct2 and I found that there's not a simply method to make a sprite follow another sprite horizontally.

    I need this because I'm making a zombie game but ofcourse I NEED a zombie that only can move horizontally (if he need to jump I know how to do that). A Pathfinding behavior/plugin doesn't worked and I've searched for another method to do that but found nothing.

    Can you help me? PLEASE!

  • Hello,

    Here is a possible way of doing what you want. Hope it helps.

    http://sdrv.ms/Q0bVd7

  • Use distance() to check if the player is far from the zombie.

    Compare player.x with zombie.x, if player.x > zombie.x, it means player is on the zombie's right.

    Use custom movement or platform behavior to make the horizontal speed of the zombie go toward a the player.

    Else check the opposite, how I usually do jumps is I place an invisible collision block called "jump" and if the zombie collides with it, it makes the zombie simulate jump or add velocity upwards.

  • oravalag I didn't open it because the Rory answer worked :P

    Rory Thanks. I finally made it. For the jump if there is any obstacle I've made a "If velocity is equal to 0 -> Simulate Jump". But I don't know if this will cause any errors or what.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Glad to be of help!

    I wouldn't want my NPCs to walk into walls before they jump.

    In Game Maker I used to check if there was an object located at the position ahead of the NPC about 30px away.

    So I would check the NPC velocity, if it was negative, I would check NPC.X - 30, if there was a object at the position.

    I can't think of any solution for this in C2 at the moment, too tired. But my workaround for now has always been to use a specific action collision box, like a "NPC touch this - jump collision object"

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