- Code: Select all
if (ActorCount("pill")<1){ExitGame();}
place this in a draw event, I used view to test it.
On the last Actor destroyed, (assuming you are using clones for the pills), this will trigger the if statement to fire.
I used ExitGame in the example, but a call to your level switching code would fire also.
- Code: Select all
if (ActorCount("pill")<1 && ActorCount("PowerNodes")<1){ExitGame();}
This code would work if you had 2 different entities, the small dots and the big power dots.
To test this code, do the following:
1. Create an actor named pill.
2. Create another actor named bigpill.
3. Make a few clone copies of each.
4. Go to the view actor, add a Draw Actor event, select Script Editor for the action, and paste the code above in it.
5. Select pill, add a mouse down event and select Destroy Actor for the action. For Actor Choice leave it Event Actor.
6. Do step 5 for bigpill also.
7. Now run Game Mode, and click on each actor, when the last one is gone, the game exits.