Only positive values

Get help using Construct 2

Post » Sun Dec 27, 2015 1:16 pm

Hi everyone! ;)

I'm creating a simple car game. I created a variable that every fraction of a second shows the current speed of the main car.
The problem is, when the car reverses. Values ​​are minus, and I want them to be positive.
How Can I do that? :ugeek:
B
5
Posts: 22
Reputation: 255

Post » Sun Dec 27, 2015 1:27 pm

'abs' gives you the absolute value.

Gloable number myVariable=-1
System Every X seconds -> Text| Set text to abs(myVariable)

Will give 1
B
23
S
3
G
1
Posts: 412
Reputation: 2,062

Post » Sun Dec 27, 2015 1:45 pm

@Asmodean Thanks! That's very helpful!
B
5
Posts: 22
Reputation: 255


Return to How do I....?

Who is online

Users browsing this forum: justintime0185, raster and 9 guests