Update PictureBox
parent
3be4a52323
commit
6f0abe13e7
@ -7,6 +7,11 @@ Part of it is simply the inefficiency of needing to load all the sprites every t
|
||||
|
||||
One very odd bit of behavior I had, at one time, was if I exited the game in the middle of a battle, my party sprites would continue to get “hit” by the enemies, even though their window had been closed and the enemies had been “destroyed.” I tried to get rid of a lot of stuff, but simply closing the window does not actually get rid of all the variables that had been part of that.
|
||||
|
||||
It is a lot simpler to program a game if it is all within one form. While you can develop games using multiple forms, things can get very messy. The SpriteLibrary was designed for use with one form, and bouncing between different forms can result in some very strange behavior. In my AdventureDemo (http://www.codeproject.com/Articles/1110409/Using-SpriteLibrary-to-develop-a-Role-Playing-Game), I used multiple forms. That was a bad idea. If I closed the main game window during a battle, the game exited and the game-menu popped up. Then, the sprites continued to fight, even though they were technically gone. The party continued to take damage, and sometimes die. It was a little disconcerting.
|
||||
The game is a lot simpler to deal with if you only have one form. This means you draw your menu on the same PictureBox that you have your game running on. You can change the PictureBox background, so you have a different looking window when the window is up, or you can leave it be. It does not really matter too much. But, please, try using putting it all in one Form if possible.
|
||||
|
||||
Having multiple PictureBoxes works fairly well, particularly with linked sprite-controllers and / or a SpriteDatabase. Both of those allow you to define a sprite once but use it on multiple picture boxes.
|
||||
|
||||
So, to sum all of this up. Try to only have one window, and the picture-boxes on that one window. If you need to have multiple PictureBoxes on one window, that is not too much of a problem. But, do not try to open new windows with new PictureBoxes and new sprite-controllers. That can end up with some rather odd behavior.
|
||||
|
||||
# The PictureBox Background
|
||||
|
Loading…
Reference in New Issue
Block a user