Destroy Actor

From Game Editor

Revision as of 12:03, 10 July 2009 by Skydereign (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Destroy Actor is both an event and a function, but the function is DestroyActor.


This event triggers when the actor is destroyed. This is clone specific, meaning clones will not be triggered if another actor of the same name is destroyed. Destroy Actor holds little use for many users, as there are ways around it, but a common use of destroy actor is to increase points. Also for random pickups, the Destroy Actor event would be a good place to hold this code. Destroy Actor does not take any specifications as it only concerns the Event Actor.


One use for Destroy Actor, would be to clean up any code or variables left loose. This is not a concern for most users as this is only necessary if you begin to use advanced C, and start using calloc or malloc.


In a lot of games, when an enemy is destroyed, it increases your points, and may even drop an item. This example shows a Destroy Actor event implemented in a similar fashion.

Enemy -> Destroy Actor -> Script Editor

int random = rand(5);
score+=50;
if(random == 0)
{
    CreateActor("powerUp", "powerUp", "(none)", "(none)", 0, 0, false);
}