# Multiply Two Variables Correctly?

Get help using Construct 2

### » Tue Jun 11, 2013 10:26 pm

I have two global number variables set in my event sheet.

RoadSpeed = 1100

and

BoostAmount = 2

When I hit a boost I am setting my RoadSpeed to "RoadSpeed*BoostAmount". Then after 5 seconds I set RoadSpeed to "RoadSpeed/BoostAmount".

So essentially I am doing 1100*2 and then 2200/2. But the number I get when I multiply the two variables is 17600, and then when it divides by 2 it goes back to 1100.

Also if I do just RoadSpeed*2 it comes out to 17600.

What am I doing wrong? Why does this not work correctly? If I use 1100*2 it works fine. What is happening to the math when it uses the variables instead of the numbers? Skedoozy2013-06-11 22:29:15
B
5
Posts: 9
Reputation: 393

### » Tue Jun 11, 2013 10:37 pm

Ef me. Just figured it out.

I was setting the speed change to happen on overlap. Well it overlapped for 8 ticks, so *2 became *16.

Set it to on collision and it works.

I'll leave this here just in case someone has the same brain fart as I did.
B
5
Posts: 9
Reputation: 393

### » Tue Jun 11, 2013 11:20 pm

Don't you love it when you spend forever trying to solve something, so you make a post about it, and figure it out 3 minutes later? lol

I do this all the time. :D
B
6
S
1
Posts: 62
Reputation: 532

### » Wed Jun 12, 2013 12:43 am

lol yeah, I am pretty good at that. It's like telling someone your problem and you figure it out as you're telling them about it. Sometimes your brain just has to think about it differently.
B
5
Posts: 9
Reputation: 393

### » Wed Oct 16, 2013 7:55 pm

so how did you do it??

how do you multiply a number by a var?

B
9
S
2
Posts: 272
Reputation: 1,632

Return to How do I....?

### Who is online

Users browsing this forum: No registered users and 2 guests