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.

Cursor rectangle over actor

lurk

Member

Hi all, quick question here, is there any way to put the rectangle cursor from the windowskin (cursor_rect) to appear in a viewport over the actor in the menu? I modified the window_base script to use a picture instead of the character sprite
Code:
def draw_actor_graphic(actor, x, y)
    bitmap = RPG::Cache.picture(actor.character_name)
but now, the rectangle cursor appears on a layer below, almost hidden by the character's portrait. Is there a way to change the cursor's z? Thanks!
 

poccil

Sponsor

It's better, then, to use a different approach.  Use this modified version
of Window_MenuStatus.  Here, you must make each character picture a size of
480x120 and put them in Graphics/Pictures, as you're doing right now.

Code:
class Window_MenuStatus < Window_Selectable
  def initialize
    @characters=[Sprite.new,Sprite.new,Sprite.new,Sprite.new]
    super(0, 0, 480, 480)
    self.opacity=0
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.active = false
    self.index = -1
  end
  def dispose
    for c in @characters
      c.dispose if c
    end
    super
  end
  def x=(value)
    for c in @characters
      c.x=value
    end
    super
  end
  def y=(value)
    for i in 0...@characters.length
      @characters[i].y=value+i*120
    end
    super
  end
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = 64
      y = i * 116
      actor = $game_party.actors[i]
      @characters[i].bitmap=RPG::Cache.picture(actor.character_name)
      @characters[i].x=self.x
      @characters[i].y=i*120+self.y
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x + 144, y)
      draw_actor_level(actor, x, y + 32)
      draw_actor_state(actor, x + 90, y + 32)
      draw_actor_exp(actor, x, y + 64)
      draw_actor_hp(actor, x + 236, y + 32)
      draw_actor_sp(actor, x + 236, y + 64)
    end
  end
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
    end
  end
end
 

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