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.

[Resolved] Battle command window

Status
Not open for further replies.
How can I make an image appear behind the battle commands (text)?
I already added some lines of script in Window_Base to show the picture. Like this:

Code:
  def draw_border2(x, y)
    border2 = RPG::Cache.picture("Border2")
    cw = border2.width 
    ch = border2.height 
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x , y - ch, border2, src_rect)    
  end

The picture always show above the commands, How can I prevent this?
Can anyone help me with this, please?
 
Thanks for the help.
It worked... but only for the last command.

I think this happens because I use ccoa's CBS and it uses a different script for drawing the commands, drawing each command at a time. Here is the script:

Code:
class Window_BattleCommand < Window_Selectable
# -----------------------------
  attr_reader :commands
# -----------------------------
  def initialize(actor, width)
    @actor = actor
    @item_max = @actor.battle_commands.size
    super(0, 0, 220, (@item_max + 1) * 32)
    self.windowskin = RPG::Cache.windowskin("")
    self.x = -9999
    @column_max = 1
    
    @commands = @actor.battle_commands
    if @commands == []
      name = actor.name
      print("Error: " + name + " must have at least one battle command.")
      exit
    end
    self.contents = Bitmap.new(width - 32, (@item_max + 1) * 32)
    refresh
    self.index = 0
  end
# -----------------------------
  def refresh
    @item_max = @actor.battle_commands.size
    @commands = @actor.battle_commands
    self.contents.dispose
    self.height = (@item_max + 1) * 32
    self.contents = Bitmap.new(width - 32, (@item_max + 1) * 32 - 32)
    
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
# -----------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    draw_border2(15, 168 + 21)
    self.contents.draw_text(rect, @commands[index])
    draw_battleface(@actor, 90, 100)
  end
# -----------------------------
  def disable_item(index)
    draw_item(index, disabled_color)
  end
end

And this is the final result:

http://img184.imageshack.us/img184/4057/bugrm4.png[/IMG]

Can you still help me?
 

Mac

Member

Post the full script you are using or send me it i know the problem.

I believe its to do with Priority and Layering because take for example.

Code:
      draw_actor_face(actor, x - 60 ,y + 160)
      draw_actor_name(actor, x, y + 80)
      draw_actor_class(actor, x + 144, y + 80)
      draw_actor_level(actor, x, y + 100)
      draw_actor_state(actor, x + 90, y + 100)
      draw_actor_exp(actor, x, y + 120)
      draw_actor_hp(actor, x + 200, y + 100)
      draw_actor_sp(actor, x + 200, y + 120)

Since
Code:
draw_actor_face
is the first it means that its drawn first and anything using the
Code:
draw_actor
code after it will be done over the top and as follows, so thats the problem but i will need to look at it to be fully sure.
 
I fixed it just now! It was pretty simple.
I just had to erase one line:
Code:
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))

Thanks to all of you who tried to help me.
 

Mac

Member

No problem..i wasn't expecting it to be a colour error...well good to hear.

RESOLVED

*Reported To Mod To Be Closed*

Please do not post anything else on here, if their are any more queries please make a new post.
 
Status
Not open for further replies.

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