Trying to figure out gallons used in a car simulator

Started by
0 comments, last by Telastyn 14 years, 10 months ago
I'm currently working on a Car System Simulator for educational use in Tech. Ed. classes. My partner and I are using Adobe Director 11.5 and I'm using the Lingo scripting language to code all the functionality for the 'game.' I've run into a problem, though, regarding the interaction between the gas gauge and the variable that keeps track of how many gallons of gas have been used. I've got a few variables: gallonsUsed milesTraveled mpg Now, every time a gallon of gas is used I would like the needle on the gas gauge to rotate -12 degrees, I've got that part down. What I can't seem to figure out is how to get the simulator to detect when it passed the next "threshold" of the gallons, when a full gallon of gas has been used. The milesTraveled is a float with 4 decimal points due to our math (.5 real time = 1 minute game time) which is why I can't really use the mod operator (milesTraveled mod mpg)
Advertisement
while(milesTraveled - (gallonsUsed * mpg) > mpg){    gallonsUsed++;    MoveGasGauge();}

This topic is closed to new replies.

Advertisement