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.

[VX] Cannot see rectangle

Hello. I am creating a script to show a map(um... the picture kind.) and your position according to your current map(sprite kind). But my problem is that when I create a rectangle and fill it, I can't see it. Maybe you can help me.

Script:
Code:
#----------------------------------------------------------------------
# Begin
#---------------------------------------------------------------------------
module Glue
  POSITION_COLOR = Color.new(0, 0, 0, 192)
end

class Game_Map
  #--------------------------------------------------------------------------
  # * Get Map ID
  #--------------------------------------------------------------------------
  def id
    map_infos = load_data("Data/MapInfos.rvdata")
    @id = map_infos[@map_id]
    return @id
  end
end
    
class SpriteMap < Sprite
  
  #-----------------------------------------------------------------------------
  # Initialize
  #-----------------------------------------------------------------------------

  def initialize(viewport=nil)
    super(viewport)
    self.bitmap = Cache.load_bitmap("Graphics/Pictures/", "Map.png")
    self.x = self.x
    self.y = self.y
    self.z = self.z
  end
  
  #-----------------------------------------------------------------------------
  # Dispose
  #-----------------------------------------------------------------------------

  def dispose
    self.bitmap.dispose
    for sprite in @icons + @weapon_icons
      sprite.dispose
    end
    super()
  end
  
  #-----------------------------------------------------------------------------
  # Update
  #-----------------------------------------------------------------------------

  def update
    self.bitmap.clear
  end
end
#-----------------------Scene----------------------------
class Scene_MapThing
    def main
      Graphics.wait(1)
      initialize
    end
  
    def initialize(viewport = nil)
       bitmap = Bitmap.new(200, 200)
      @viewport = viewport
      @x = 100
      @y = 100
      [color=red]bitmap.fill_rect(bitmap.rect, Glue::POSITION_COLOR)
      map_rect = Rect.new(100, 100, @x, @y)[/color]
      @mapic = SpriteMap.new(@viewport)
      @mapic.x = 50
      @mapic.y = 90
      update
    end
  
    def update
      Graphics.wait(1)
      update_position
      if Input.trigger?(Input::C)
        $scene = Scene_Map.new
      else
        return
      end
    end
  
    def update_position
      @Map = $game_map.map_id
      if @Map = 002
        @x = 200
        @y = 200  
      else
        @x = 200
        @y = 200
      end
    end
  end

My rectangle instances are in red.
If you could help, that would be great!

Thanks in advance
-LonelyElf
 

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