I need help with events

  • Hello everyone, I'm fiddling with my first project, and I could use some help with events. I'm doing a simple topdown game, I figured out how to move with WASD, so that's a start.

    Now, I'm trying to make it so that when "spacebar" is pressed, the players "punch" animation plays. As it is now it doesn't play, could someone explain to me how to make it work?

    I attached a screenshot of my events:

  • It's because when you press space to set an animation, one of your speed checks is always true and overrides the one time setting of that animation. You'll need to set some kind of character state by way of global variable when the character goes to punch, and under the speed checks say when character is not set to punch, so the punch animation can play. You then have punch on a timer so say after 1 second you set him back to not punching, the other idle animations would then take effect.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ahh, thank you very much!

    My next question is regarding physics (I'm guessing)

    I can make the player punch stuff and change the animation of the thing getting punched, but I want it to glide a little bit too, would you mind explaining how to do that too?

  • Depending on what side you are getting punched from you set player vector x to player.x-50 or player.x+50 to move the player (the 50 is a random value of distance), and I guess you lower the deceleration so they appear to glide rather than abruptly stop.

  • Ah, okay. Thank you.

    I set it to be a bullet, then toggled it on when hit, changed its speed to 100, then set the angle of motion to player.angle, and set the bullets acceleration to -50. Voila! This is extremely neat.

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