How do I knock back

0 favourites
  • 3 posts
From the Asset Store
Helping streamers give their viewers more excitement.
  • So I have my character knocking back when the Owl Wind hits him. I am trying to get him to be knocked back possitive direction when he is on the right side of the owl...not sure how to do this..

  • You could just check the Owl.X against the Character.X and set it negative accordingly:

    If Owl.X < Character.X then knockback = knockbackAmount

    if Owl.X >= Character.X then knockback = -knockbackAmount *

    The above pseudo code should give a good idea of what to do. Hope it helps and good luck with your project.

    (* One note, this line has a greater than or equal to because of you only test < or > and forget the = you will introduce a bug where knock back never happens when the values are equal. You may already know this but I have seen many people forget to include the equal to in these situations so I am spelling it out just in case.)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • looks like this worked, thanks for the reply

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