How do I knock back

Get help using Construct 2

Post » Sun May 04, 2014 4:55 am

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 do not have the required permissions to view the files attached to this post.
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Sun May 04, 2014 5:07 am

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.)
B
38
S
12
G
11
Posts: 331
Reputation: 7,712

Post » Sun May 04, 2014 5:23 am

looks like this worked, thanks for the reply
You do not have the required permissions to view the files attached to this post.
B
9
S
2
Posts: 272
Reputation: 1,632


Return to How do I....?

Who is online

Users browsing this forum: blue visionary and 24 guests