Fuel overflow.
Ive watched some score keeping type videos. But Ive yet come across one that covers my problem.
Here is my problem.
My ship is constantly using fuel and constantly gaining fuel based on colliding with fuel pod actors.
Example:
Fuel Pod 1= 20 Units of fuel
Fuel Pod 2= 30 Units of fuel. etc etc
My fuel tank holds 100 units of fuel. Atrribute Integer "FUEL" Start games at Fuel units 100
My timer says every 1 sec change Fuel to Fuel -2. So Im using 2 units of fuel every sec.
If I collide with a pod. That pod adds that many units to fuel attribute.
Now I've given the pods a rule. IF ALL "collides with Ship" and "Fuel attribute is less than 100". For that
pod to add its fuel units.
Here is the issue. Lets say the ship has 90 Units. And it hits a pod that gives 20 units. The fuel attribute is now 110.
I know this is because it is how I've coded it. But I would like it to top off at 100 even if the fuel pod has more than the tank can hold. SO when it has 90 units of fuel and hits a 20 unit pod. The tank will register 100 and not 110.
Im thinking this could be done with % based rules. But I know nothing on how to do this.
can someone point me to a good video to explain this?
Here is my problem.
My ship is constantly using fuel and constantly gaining fuel based on colliding with fuel pod actors.
Example:
Fuel Pod 1= 20 Units of fuel
Fuel Pod 2= 30 Units of fuel. etc etc
My fuel tank holds 100 units of fuel. Atrribute Integer "FUEL" Start games at Fuel units 100
My timer says every 1 sec change Fuel to Fuel -2. So Im using 2 units of fuel every sec.
If I collide with a pod. That pod adds that many units to fuel attribute.
Now I've given the pods a rule. IF ALL "collides with Ship" and "Fuel attribute is less than 100". For that
pod to add its fuel units.
Here is the issue. Lets say the ship has 90 Units. And it hits a pod that gives 20 units. The fuel attribute is now 110.
I know this is because it is how I've coded it. But I would like it to top off at 100 even if the fuel pod has more than the tank can hold. SO when it has 90 units of fuel and hits a 20 unit pod. The tank will register 100 and not 110.
Im thinking this could be done with % based rules. But I know nothing on how to do this.
can someone point me to a good video to explain this?
Comments
Hi @Jeffnichols it all seems fair enough the rules you have so far...
To take account of the issue you're experiencing, simply add another rule nested in your existing rules:
When scene.Fuel > 100
Change Attribute scene.Fuel to 100
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Hey @TesseractEngine You do deserve one; whistled in, then out again, without sight or sound to me...impressive! :-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
...THE THREAD NINJA!
I think there must have literally been seconds between our posts.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
I was praying it wasnt a % thing