Draw actor

From Game Editor

Revision as of 17:14, 21 January 2011 by Dst (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Draw Actor

Draw actor is an actor event that allows you to insert script into the actor's routine. It runs every single frame of the game, so events placed here are not 'trigger based', as keydown, animationfinish, etc. events are.

To understand draw actor, here's a simple test:

Create an actor, and add an event > draw actor. In that draw actor script, type

 x+=5;

and click ok. It will prompt you for immediate action, or wait for frames. Choose immediate.

Now run the game, and you can see your actor moving by five pixels each frame.


The sequence of game editor is as follows:

 1. Get all inputs from the user
 2. Run all event functions (changeanimation, pathfinish, movefinish etc. 
 3. Run all draw actor scripts.
 5. Output display to screen.

And then start again. So you can see where you draw actor fits into the scheme of everything.

One final note: When you are entering multiple scripts into an actor, it is best to use one single draw actor event for this; events cannot be renamed so if you add multiple draw actors, when you go to edit them you will get a list saying Draw Actor Draw Actor Draw Actor

This is super confusing, so it's best to just have one per actor. You can add as much script to this draw actor as you want.