Detect Number of Animies and Game Over
In my game I have car(user) and petrol tank(enemy ) when car collide with tank after 1-2 seconds I am showing level complete screen. But in few levels I have 2-3 petrol tanks.
And that time when car collide with 1 pertrol tank its showing game over screen still 2 more petrol tank is stady. How do I setup that after collide and destroy all 3 tanks its showing level complete screen. In each level I have dynamic petrol tanks. Please help me out.
And that time when car collide with 1 pertrol tank its showing game over screen still 2 more petrol tank is stady. How do I setup that after collide and destroy all 3 tanks its showing level complete screen. In each level I have dynamic petrol tanks. Please help me out.
Comments
in each level
game.gas = # of gas
rule
collide with gas
gas = gas-1
otherwise
spawn game over
(or interpolate alpha or whatever)
instead of otherwise you could
if game.gas=0
spawn game over
also, please wait more than 20 minutes to bump a post. Wait like a day or so.
Another way you could do it, if you didn't want to unlock any instances is to put a change attribute: game.gas to game.gas+1 on the prototype for the petrol tank
then have a rule on the car when overlaps or collides with petrol tank
change attribute:game.gas to game.gas-1
[you'll have to put the next rule in a very short timer if the actor it is on is layered below the petrol tanks]
rule on any actor that when game.gas = 0
level complete behaviours
Thanks
Just so you know I am working on your project right now. For this create an integer attribute for each level. For level 1 create - LVL1Tanks starting at 3
Then go into your car in lvl 1 an make it an instance. When it collides with a tank change game.LVL1TANKS to game.LVL1TANKS - 1
RULE: When game.LVL1TANKS = 0, change scene to next scene
Matt