How do I change angle with same button

Get help using Construct 2

Post » Sat Jul 11, 2015 9:12 pm

hi everyone
I used custom movement behavior with angle
its like
space is down player set custom movement angle to 320
overall speed to 300

space is released player set custom movement angle to 230
overall speed to 300

i want to make it like when you press space when the angle is 320 change it to 230 and when it is 230 change it to 320.

i try to use variable first text and then number it worked when i first pressed space then it wont change the angle
it works like only once
how can i make it work ?

sorry for my english
B
4
Posts: 9
Reputation: 222

Post » Sat Jul 11, 2015 10:03 pm

on space pressed
-- angle is 320
> set angle to 230
-- else
> set angle to 320
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Jul 11, 2015 10:34 pm

LittleStain wrote:on space pressed
-- angle is 320
> set angle to 230
-- else
> set angle to 320

it is same with current build
what i want is for example when i press space and make it turn right if i dont press anything it goes non stop right after that when i press space again change his direction to left and if i dont press space again it goes left non stop
B
4
Posts: 9
Reputation: 222

Post » Sat Jul 11, 2015 11:10 pm

Add a global variable rotation

on space pressed
> system set rotation = 1-rotation

system compare two values : rotation = 1
> sprite rotate clockwise

system compare two values : rotation = 0
> sprite rotate counter clockwise

You could ofcourse also do this by toggling a boolean instance variable..
or using an instance variable as above..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: Mayfly and 8 guests