Page 1 of 1

Draw and create actor....

PostPosted: Wed Oct 03, 2007 11:27 am
by Kalladdolf
Now, you might think: What do u need that for?
BUT I DO!!!!!!! :oops:
Here's the question:
How can I have an event a bit a mixture of Create Actor and Draw Actor?
The thing is: the actor must be ready anytime to execute the action, but only once and then stop (not repeat it like in the draw actor event).


Is it possible some way? :|

Re: Draw and create actor....

PostPosted: Wed Oct 03, 2007 11:41 am
by pixelpoop
You can have a draw actor event test a variable every frame and then only do some code while the condition is met.

if (my_variable==1){do this...
and this...
and this...
my_variable=0;
}

When you want the actor to execute this code just change "my_variable" to 1. Like on a collision event you would put:
actor_name.my_variable=1;

edit:
also you don't need to always create and destroy actors, you can also just change it's VisibilityState: VisibilityState("Event Actor", DISABLE);
So at the end of the above code you could just turn the actor invisible.

Re: Draw and create actor....

PostPosted: Wed Oct 03, 2007 11:52 am
by Kalladdolf
yup, I tried that before, this whole matter is a little complicated:

There are many actors who must execute this thing. If the variable is 0 after the action, it disables the action for the other actors. I have one button to activate the variable (put it to 1). If the variable would be an actor variable, you couldn't activate the variable for all actors at the same time!

Get, what I'm trying to say? :o

Re: Draw and create actor....

PostPosted: Wed Oct 03, 2007 1:40 pm
by pixelpoop
you could activate the local variables for all the actors at the same time if you named them all in your script.

actor1.local_variable=1;
actor2.local_variable=1;
etc.

or if it is a key stroke then you could do the first example except with a local variable nested inside a global and then on the key up command you reset the global variable:

key down event: global_variable=1;
key up event: global_variable=0;

on the draw actor event:
if (global_variable==1 && local_variable==1){
actions here...
local_variable=0;}
if (global_variable==0){local_variable=1} //this resets local_variable a frame after global_variable gets resets

Re: Draw and create actor....

PostPosted: Wed Oct 03, 2007 2:44 pm
by Kalladdolf
well, thanks, that should be able to work :D

My fingers'll be sore, though.....