Reload Form

12-18-2001, 01: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?

12-18-2001, 02: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.

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

12-19-2001, 09: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.

12-19-2001, 12: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.

12-19-2001, 04: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

12-20-2001, 11:22 AM
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