Platformer - getting damaged and jump back

  • I'm working on a platformer and I'm trying to figure out how to make the player jump backwards and become invincible for a few seconds when he hits a enemy/spikes. It's common in many platforming games.

    Like this

    What would the right term be? Knockback?

  • Manipulate the VectorX and VectorY expressions for knockback, and manipulate a variable for being invisible...

  • and during your knockback be sure to disable the platform behavior on the player

  • Manipulate the VectorX and VectorY expressions for knockback, and manipulate a variable for being invisible...

    Eeer, what?

    Oh, I get it!

    there's VectorX and VectorY expressions in the platform behavior. What's the difference between VectorX,Y to Set X, Y? Is it that it's animated smoothly?

    Edit : Also, here is the capx file for anybody who wants to see it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • the difference is:

    Vector will trace a path;

    Set will pop the object directly, without transaction, to the point;

  • for short invincibility for the player after he gets hit, put the events (for the hit and damage) inside a group, and on hit, disable that group for like 2 seconds or whatever you want then enable it again

    for jumping back, like the guys said, set the vector x to + or - depending on which side the enemy is on. to determine which side of the player the enemy is on, you can create an event condition like:

    if Player.X < Enemy.X (for player on the left)

    --> set Player vector x to -300 or something

    if Player.X > Enemy.Y (for player on the right)

    --> set Player vector x to 300 or something

    hope that helps :)

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