Multiply Two Variables Correctly?

0 favourites
  • 5 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I have two global number variables set in my event sheet.

    RoadSpeed = 1100


    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? <img src="smileys/smiley19.gif" border="0" align="middle" />

  • 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.

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • so how did you do it??

    how do you multiply a number by a var?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)