Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Display windows in game map

I want to display the shop window in map, but in a configurable way, of course, so, it can be
displayed in the map or in his own scene.

But im unsure on how to do that, i think there are some scripts that do this, no? how?
 
You could create the shop system as an independent class and not as part of the scene so you can create a shop object in any scene.
You can also check the scene in the shop script by using $scene == class or $scene.is_a?(class) so your script knows how to behave.
 
Since this is you (gerrtunk) asking, I'm not quite sure if I got you wrong, because the solution to what I have in mind is quite simple and a pretty basic thing... so if I got you wrong, don't mind me ^^"

Because of the generic way RM scenes are built - if you stick to the standard - windows are in their nature independent from scenes entirely. If you take Window_Gold as an example: It's an instance of Window_Base, getting defined for itself, however is used in Scene_Menu, Scene_Map, Scene_Shop and who knows in how many of the custom scripts without any modification needed to the actual window itself. It just displays the money, whereever you want.

You can do exactly the same by defining a Window_Bazinga as an instance of Window_Base, then simply reference it as on object in the scene you want (i.e. @bazinga_window = Window_Bazinga.new).

If you need customization, you can always use arguments to modify the window within it's own class. For example, you could do this initialization method:
Code:
class Window_Bazinga < Window_Base

  def initialize(width = 600)

    @width = width

    # ...

  end

end
That would default to a width of 600 if no parameters are supplied, and would adjust to the given width if there are.


Assuming you knew all this really... what were you talking about? ^^


By the way: Game_Map has nothing to do with it at all.
 
Unless you want the map to update in real time, its wise to just stick to Scene_Shop. Assuming you don't do your shop system in Scene_Map, the way I do it is...

Code:
class Scene_Shop

  alias ssmap_scnshop_main

  def main

    @spriteset_map = Spriteset_Map.new

    #@window_???.opacity = > 255 so you can see behind them

    ssmap_scnshop_main

    @spriteset_map.dispose

  end

  alias ssmap_scnshop_update

  def update

    @spriteset_map.update if @spriteset_map && !@spriteset_map.disposed

    ssmap_scnshop_update

  end

end

You'll have to set any/all of the windows opacity less than 255, especially if the whole screen is covered in windows, or you will not see the map. Hope this helps, good luck!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top