How do I create steps?

Get help using Construct 2

Post » Thu Apr 18, 2013 7:50 pm


Absolutely love the program by the way, am so glad I found it.

I am having trouble phrasing my issue, so I will just say what I want to happen...

-----------------------
(keyboard) space pressed
+ (sprite position) X=74    -then-    (set sprite position) X=88 Y=274

(keyboard) space pressed
+ (sprite position) X=88    -then-    (set sprite position) X=69 Y=127

(keyboard) space pressed
+ (sprite position) X=69    -then-    (set sprite position) X=476 Y=195

------------------------

So I want to press the space bar and have the sprite reposition, then hit space bar again and have the sprite reposition again. Right now If I hit space bar it skips the middle step and jumps to the final position (if I disable the final event, it repositions correctly to the 2nd event).
I am not sure what more I need to do. Thank you!


B
9
S
2
Posts: 54
Reputation: 664

Post » Thu Apr 18, 2013 7:53 pm

@danielbishop56 - Try adding an 'Else' condition to your last two events:

-----------------------
(keyboard) space pressed
+ (sprite position) X=74    -then-    (set sprite position) X=88 Y=274

Else
(keyboard) space pressed
+ (sprite position) X=88    -then-    (set sprite position) X=69 Y=127

Else
(keyboard) space pressed
+ (sprite position) X=69    -then-    (set sprite position) X=476 Y=195

------------------------
B
9
S
3
G
4
Posts: 63
Reputation: 3,083

Post » Thu Apr 18, 2013 8:49 pm

Hi rN, unfortunately I cannot add 'Else' there, it claims it is invalid.

I tried adding a 'Wait 1 second' to the actions of each event but that didn't seem to work either. danielbishop562013-04-18 21:02:17
B
9
S
2
Posts: 54
Reputation: 664

Post » Thu Apr 18, 2013 9:01 pm

Else is only valid if it's the first condition AND also only if the previous event is not a trigger.

You could also just reverse the order of your events.Magistross2013-04-18 21:05:07
B
45
S
16
G
18
Posts: 845
Reputation: 13,673

Post » Thu Apr 18, 2013 9:01 pm

Try reversing the order of your events.
Edit... I'm too slow.R0J0hound2013-04-18 21:02:54
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Thu Apr 18, 2013 9:04 pm

Oh sweet that totally worked!

I would be very grateful if someone could explain why that worked, in case I encounter this again...
B
9
S
2
Posts: 54
Reputation: 664

Post » Thu Apr 18, 2013 9:08 pm

Actions are processed before the evaluation of the next event's condition occurs. So basically, your sprite is climbing all steps at once, because all events were executed since all conditions were true at the time they were evaluated.

Usage of "else" statements would have prevented this, but key press are "trigger event". You could have used a combination of "key is down" and "trigger once" though...Magistross2013-04-18 21:13:38
B
45
S
16
G
18
Posts: 845
Reputation: 13,673


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 14 guests