Reload Form

Iceplug
12-18-2001, 02:31 PM
Hello. I am working on a platform game and it is going great - but my player only has one life and there are (about) 30 levels. I gave my player the ability to have more than one life, and I used "Unload Formn: Load Formn" to get the level back to its original form, but the monsters and hazards act strange and don't work. Is there another way to revert a form back to its originality?

divil
12-18-2001, 03:03 PM
It sounds like a terribly bad way of doing it, but you could always Dim as new Form and then show that one, before disposing of your old one.

robot313
12-18-2001, 10:20 PM
You might try refreshing the form. Form1.Refresh

dcl3500
12-19-2001, 10:24 AM
You might try putting the code that initializes the form into a sub called...oh let's say, "initialFormSettings". Then when you character dies you can just call this sub, refresh the form and get on with the life images/icons/smile.gif.

Iceplug
12-19-2001, 01:38 PM
Sorry, it still doesn't work. If I make (Dim) a new form, I receive an error "Object '4' Doesn't Exist", even though the object does exist (I checked its properties in Immediate but the error occurs while the game is running). I already tried the refresh and the same things happened. I also put my load stuff into a sub and it worked fine - except my player doesn't go back to the initial position.

dcl3500
12-19-2001, 05:18 PM
If reinitializing the form works from a sub then store the player's start position in a global variable that will not go out of scope. Then pass that variable to the initialize code to place the player in the right spot.

public sub reinitializeForm(PlayerLoc as 'Whatever type variable you need here)

then when you call the sub

reinitializeForm myPlayerLoc 'MyPlayerLoc is the global variable holding the player's location

AHWilliams
12-20-2001, 12:22 PM
Just to repeat what everyone has already said, everything you do to start the game should go into one proceedure. At some point in your game you have to define the players starting location, put that in RestartGame(). Also, variables should always be initialized in RestartGame (even if they start at zero). That way when you restart your game all variables will be reset.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum