How do I check if an object (player) is moving up on Y

Get help using Construct 2

Post » Wed Mar 02, 2016 12:13 pm

Greetings!

I'm new here and so far I really like what I get with Construct 2.

I have a simple question on events.
I'm trying to make an object (sprite) move only when the player goes up on the Y axis.
But no matter what I try with angles and compare values it either moves regardless of the player not moving up on Y. Or doesn't move at all.
Does anyone have a tip which condition I should use and how?

Probably a fine idea will be to compare values but all I want is to check if the player is moving up.


Thank you in advance!
B
3
Posts: 3
Reputation: 181

Post » Wed Mar 02, 2016 12:43 pm

what does your code look like? You should be able to accomplish this by simply comparing the Y values of your sprites

Player Old Y value > Player New Y value then you need to move your other sprite since the Player is moving up on your screen. Is this what your trying to accomplish????
B
9
S
3
Posts: 56
Reputation: 801

Post » Wed Mar 02, 2016 1:17 pm

Exactly.

I should've started with that I'm no developer and have very limited knowledge of code. Which is why I was trying to handle this with simple event commands.
B
3
Posts: 3
Reputation: 181

Post » Wed Mar 02, 2016 2:21 pm

Yup the way I explained is about the easiest way. Hope it helps you....
B
9
S
3
Posts: 56
Reputation: 801

Post » Wed Mar 02, 2016 2:24 pm

Here I just tried an approach - not a good one, but kind'a works

https://www.dropbox.com/s/4mmd7iuhjlvb3 ... .capx?dl=0

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Wed Mar 02, 2016 2:39 pm

Thank you guys :) I really appreciate the fast support. It works now.
B
3
Posts: 3
Reputation: 181

Post » Wed Mar 02, 2016 2:42 pm

The easiest one if possible

if keyboard "up arrow" is down move object

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, Lancifer, richcoz81, Yahoo [Bot] and 27 guests