How do I have my player attack?

0 favourites
  • 6 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • I want it so when the player presses 'space' the player goes through an attack animation and when it collides with the enemy it subtracts health from it, to ti then reverting back into the normal idle position for the player to progress with the game. I tried a tutorial of Jerminator online but it hasn't worked. Help please. Its a sidescroller metroidvania game and the attack is a melee.

  • First you need to have the animation for the sprite, after that you will need a separate sprite pinned to an image point near the weapon for collision detection. Then you add an keyboard object to your project and add an event on key space pressed, and as action play the animation, make a wait system expression( 2 seconds or something like that), and reset the animation back to default.

    As a sub event add the collision detection, use the sprite pinned to the image point and check if its touching the enemy, if it does subtract from his heath.

  • Alright, seems legit, ill give it a go, thanks!

  • If its okay can you show me a screenshot of what these events would look like?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well I cant make the events without the sprite animation, if you can send me the player and all of its animation I can make an example capx file.

  • If its okay can you show me a screenshot of what these events would look like?

    What kinda of attacks are you trying to do? Shooting, sword combo attack, punching... depending on what you wanna do will change how the events come together

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