Movement using local number variable

Get help using Construct 2

Post » Thu Dec 08, 2011 1:31 pm

I'm having trouble with changing the movement of an enemy via numb variables.



Move = 2 easily sets to Move = 1 when overlapping, but doesn't work vice versa.
Also using boolean works fine.

capx
B
33
S
12
G
7
Posts: 227
Reputation: 7,582

Post » Thu Dec 08, 2011 1:47 pm

Your problem is about the same as in this topic.

The same solution applies, you have to set another variable that you will check to know if the value of Move has been changed already or not.Kyatric2011-12-08 13:48:05
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Thu Dec 08, 2011 1:56 pm

Thanks, totally missed that thread.
B
33
S
12
G
7
Posts: 227
Reputation: 7,582

Post » Thu Dec 08, 2011 2:17 pm

In your case it seems to be a toggle
you don't need another variable, just a bit of math

[code]Koopa: is overlapping flag
    -> Koopa: set Move to 3-Koopa.Move[/code]

if move = 1 -> 3-1 = 2
if move = 2 -> 3-2 = 1Yann2011-12-08 14:18:08
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Thu Dec 08, 2011 11:10 pm

Works great, thanks.
B
33
S
12
G
7
Posts: 227
Reputation: 7,582


Return to How do I....?

Who is online

Users browsing this forum: Khamsou, Yura G and 12 guests