Draw and create actor....

Game Editor comments and discussion.

Draw and create actor....

Postby Kalladdolf » Wed Oct 03, 2007 11:27 am

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? :|
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: Draw and create actor....

Postby pixelpoop » Wed Oct 03, 2007 11:41 am

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.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Re: Draw and create actor....

Postby Kalladdolf » Wed Oct 03, 2007 11:52 am

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
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: Draw and create actor....

Postby pixelpoop » Wed Oct 03, 2007 1:40 pm

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
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Re: Draw and create actor....

Postby Kalladdolf » Wed Oct 03, 2007 2:44 pm

well, thanks, that should be able to work :D

My fingers'll be sore, though.....
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron