like old-school platformers (VVVVVV, Prince Of Persia ...etc). Should I delete all the assets from old room and draw new ones every time I need to change the room, or there is some other way ? I also need room transitions for: main menu --> game --> show end game screen cycle, but I couldn't find any working examples (plain gosu, without other gems)
I like the pattern where you define a
class that has the same callback methods as
, ...). The window has "one" state at all times, and forwards all its callbacks to it.
One example is here:https://github.com/belen-albeza/space-shooter/blob/master/engine/game.rb
Then when you want to show something different, you just replace the
instance of the main window. The pattern is very flexible. For example, if a dialog box state wants to show the game in the background, it can just have a reference to the "last state" and in its
method, it can first draw the old state, then draw its information on top. You can also realise transitions in a similar way.
I use this pattern absolutely everywhere. :)
It may not be very good practice, but I use the same method as RPGMakerXP.
$scene is a class that handles a scene.
$scene.main and calls a draw in the window draw method.
In your case, I would create a main menu scene, end screen and a map scene. The map scene can load new maps within itself without requiring a scene change, and therefore leaving assets that exist through both scenes loaded through a comparison.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill