Page 1 of 1

working with actors in and out of view

PostPosted: Sat Jul 21, 2007 2:59 pm
by foleyjo
Hello
This is my first post to the forum and my first cry for help :cry:

What I want to know is how can I make an actor not exist till it comes into view and then destroy it when it leaves view again

Ill Explain:
Top down vertical shooter. The actors are laid out in place waiting to come into view. As soon as they come into view they do what they are supposed to do and if they are lucky dont get destroyed. They then leave view where they are no longer needed and are destroyed.

I tried to do an out of vision event to destroy the actor but they start the game out of vision so they are destroyed instantly

PostPosted: Sat Jul 21, 2007 3:46 pm
by d-soldier
I recall having the same problem in my first or second game. What I did was create a big filled region actor just off/below the view, which destroyed them when they collided with it. Another thing to take into account is the score though. So you need to set up two seperate ways for them to die, one being that their health reached zero, and the player's score increases, they explode, etc. The other being that the collided with the filled-region, which sould not increase the score, or make any kind of explosin/sound effect.

PostPosted: Sat Jul 21, 2007 4:53 pm
by foleyjo
Ahh that makes sense. My destroy actor has no events so im safe with that.

I suppose I could also use a region at the top that triggers actors to start there events so they dont move about till needed. Unless theres a better way!!

PostPosted: Sat Jul 21, 2007 4:56 pm
by d-soldier
I'm sure there is a better way, but I'm a visual person... I can see a filled-region actor in all it's blue box glory, and so I understand it, it's location, and it's purpose. Someone can probably tell you how to script the whole thing, which would eliminate the collision event, thereby making the game run better (even if not noticably).

PostPosted: Sat Jul 21, 2007 5:19 pm
by foleyjo
I just found the box that says recieve events if out of view which I think sorts out my problem of not wanting the actors to do anything till the view gets to them. However will this stop my deadzone (i used a region with this name at the bottom to destroy my actors like suggested) from working. I have the collision command in the deadzone saying if anything collides with it then destroy the collide actor

PostPosted: Sat Jul 21, 2007 5:34 pm
by foleyjo
Of course

out of view action

If actor.y is lower than player then destroy actor

no need for collisions then and i can use it on things that dont have collisions enabled

PostPosted: Sat Jul 21, 2007 8:55 pm
by foleyjo
i can only get that method to work if the actor starts in view anyone know why