Simple beat 'em up enemy movement towards player?

0 favourites
  • 11 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • I am designing a cyberpunk game called "Psi" about a woman with psionic (mental) powers against a horde of nanobot created zombies and murderous machines. I am trying to make the enemies move towards the player's position without changing the angle of the sprites. In this picture, I'm simply trying to get the zombies to chase the mutant.

    <img src="https://dl.dropboxusercontent.com/u/60595907/Psi%20screen%201.jpg" border="0" />

    The closest behavior to what I want that I've found is "Accelerate CustomMovement 100 towards (Player.X, Player.Y)" but this makes the zombies accelerate and shoot past and then eventually reorient and come back, each time, overshooting it further. What I am wondering is, is there a simple move towards position command somewhere that I'm missing? If not, it seems like it would be a very simple thing to implement and would save people working on games similar to mine a lot of time. Thank you for any help.

  • Did you look at the moveto example in the new project dialog?

    Using bullet without setting angle is a possibility.

    You could also use the moveto 3rd party plugin, you can find it in the plugin section.

  • No. Thank you, I will look. I tried bullet behavior but it kept changing the angle of the sprites which made for a comical look and behavior.

  • In the bullet behaviour properties you can set the set angle to no.

  • OK, I did that. I set angle to no and added event, System every tick set angle towards Player.X, Player.Y, set bullet speed to 100. The zombies flip upside down and fly off the right side of the screen. I wonder what I'm doing wrong.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think you are setting the sprite angle instead of the bullet angle..

    And probably you'll want to set the bullet speed back to 0 when the distance to the player is close enough.

  • for each zombie

    system compare two values : distance(zombie.x,zombie.y,player.x,player.y) < 50

    zombie set bullet speed to 0

  • When I try to set the angle of motion on the bullet, it only has one value. If I put in Player X or Y, in both cases, the angle of the zombie stays right but they move off of the screen. Sorry if I'm being obtuse and thanks for your help! How will I make the movement stop at a certain distance from the player?

  • Sorry, I posted that last question before I saw your reply. Thanks!

  • bullet set angle : angle(zombie.x,zombie.y,player.x,player.y)

  • Works great. Thanks for your help. <img src="smileys/smiley1.gif" border="0" align="middle" />

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