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.

Item gate

i whould like have this:
3 Windows.
*Title
*items
*Ok Button.

Item are shown if you have the Keyitems (Keyitems are a Array of that ids)
you can chose one or more items. (this will become gray)
you can remove your chose.
if you have one or more items selected you can chose OK.

if the chosen items corect then aktivate a switch.
if not then play sound.

i have build a little part of it:
Code:
Width=200
Keyitems=[1,2,3,4,5,6,7,8,9]
#-------------------------------
class Window_Schloss_text  < Window_Base
  def initialize(titel)
    super(200, 144, Width,154)
    self.opacity = 0   
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.draw_text(0,0,width-32,32,titel,1)
    self.contents.draw_text(0,height-69,width-32,32,'ok',1)
    @data=[]
    for i in 0...Keyitems.size
      #hier wird gepr?ft was angezeigt wird.
      if $game_party.item_number(Keyitems[i])!=0
        @data << $data_items[Keyitems[i]]
      end
    end
    for i in 0...@data.size
      bitmap = RPG::Cache.icon(@data[i].icon_name)
      self.contents.blt((width-32)/2-12*@data.size+i*24,45,bitmap,Rect.new(0,0,24,24)) 
    end
  end  
end
#-------------------------------
class Window_Schloss_titel  < Window_Base
  def initialize
    super(200, 160, Width,32)
    self.back_opacity = 180
  end    
end
#-------------------------------
class Window_Schloss_Items  < Window_Base
  def initialize(id,items)
    super(200, 192, Width,48)
    self.back_opacity = 180        
  end 
end
#-------------------------------
class Window_Schloss_ok  < Window_Base
  def initialize
    super(200, 240, Width,40)
    self.back_opacity = 180
  end    
end
#-------------------------------
class Scene_Schloss
  def initialize(id,items,titel='Schloss')
    @window_st = Window_Schloss_titel.new
    @window_si = Window_Schloss_Items.new(id,items)
    @window_so = Window_Schloss_ok.new
    @windoe_st2 = Window_Schloss_text.new(titel)
  end
   
  def main
    Audio.me_stop
    Audio.bgs_stop
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    @window_st.dispose
    @window_si.dispose
    @window_so.dispose
    @windoe_st2.dispose
  end
  
  def update
    @window_st.update
    @window_si.update
    @window_so.update
    @windoe_st2.update
    if  Input.trigger?(Input::B)
      @window_st.dispose
      @window_si.dispose
      @window_so.dispose
      @windoe_st2.dispose
    end
    #hier dann die Tastatur- oder Aktivit?tsabfrage
  end
end


i hope for help.
 

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