Fuel overflow.

CaptFinnCaptFinn Member Posts: 1,828
edited January 2013 in Working with GS (Mac)
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?

Comments

Sign In or Register to comment.