Level Reset - Is this OK

Non-platform specific questions.

Level Reset - Is this OK

Postby foleyjo » Thu Aug 25, 2011 10:14 am

Just wanted to run something past you more experienced people.

I am working on a game where the levels are made using activation regions.
To reset a level I am moving the view to an activation region where there is one invisible actor with a timer. When the timer reaches 0 the view moves back to its previous location.

This seems to reset the level however I was wondering if anyone knows if this method had the potential to cause problems or is it fine to do it this way
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Re: Level Reset - Is this OK

Postby skydereign » Thu Aug 25, 2011 10:26 am

Well the only major problem with that method is that any actors destroyed in an activation region by DestroyActor will not be recreated when you enter a level. So, what you should do is create spawn actors to create any enemies or any other actor that will be destroyed, and since when you enter an activation region all the actors are recreated, they'll retrigger their create actor events, which you'll use to create the real enemy actors.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Level Reset - Is this OK

Postby foleyjo » Fri Aug 26, 2011 7:42 am

Thanks Sky

Just to clarify when you say
any actors destroyed in an activation region by DestroyActor
are you referring only to actors not created at start-up in that particular region. Am I also right in thinking that all local variables will be reset to there initial values but global variables will keep there previous values.

If so then I think I have the best method for my game.
A puzzle game with single room levels. t's a total reset of the room that I am going for. So everything returns to it's starting position.
The player is spawned from a "start block" when each room starts.

I did consider giving actors variables with there start positions in and then moving them all to these positions on a reset but this method seems much more convenient in a puzzle game
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Re: Level Reset - Is this OK

Postby skydereign » Fri Aug 26, 2011 7:52 am

Right, no actors created by CreateActor will remain when you leave the region, and any actors destroyed with DestroyActor will no longer exist. Local variables are reset as the actor is being created again, but as you said global variables are untouched. The use of spawn actors is to allow you to destroy an actor with DestroyActor, and still have the level resettable, so what you are doing sounds good to me. Activation regions can be very helpful if you know what you are doing.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Level Reset - Is this OK

Postby foleyjo » Fri Aug 26, 2011 8:46 am

Thanks again Sky.

It's the first time I have used the Activation Regions. I usually work with multiple ged files but I figured that would not be appropriate for the game I'm currently working on.

I'm glad you explained the destroyed actors not being recreated. I havent needed to destroy anything other than the player up to now and that hasn't mattered due to the way player is spawned.

I do have one actor used as a pickup however I have been using a variable to say if it is collected or not. If it has been collected i have disabled its visible state rather than destroy it.
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest