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.

Help with showing picture.

How would I go about showing a picture within my battlestatus window?

I've read tutorials, but I'm having a hard time picking some of this stuff up.
 
Sorry for the bump. Here is what I have tried in Window_BattleStatus

def draw_picture(picture, x, y)
bitmap = RPG::Cache.picture("Dragonhead.png")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new (0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end

I also tried:
self.bitmap = RPG::Cache.picture("Dragonhead.png")

but apparently that method does not exist in Window_Base? Sorry, but I am very much a beginner with scripting.
 
I inserted what MeisMe
bitmap = RPG::Cache.picture('NAME')
self.contents.blt(x, y, bitmap, Rect.new(ox, oy, width, height))
said in the def initialize.

class Window_BattleStatus < Window_Base
# ------------------------------------
def initialize
super(0, 320, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
@level_up_flags = [false, false, false, false]
refresh
end
# ------------------------------------
def dispose
super
end
# ------------------------------------
def level_up(actor_index)
@level_up_flags[actor_index] = true
end
# ------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors
actor_x = i * 160 + 4
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 32, 120)
draw_actor_sp(actor, actor_x, 64, 120)
if @level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, actor_x, 96)
end
end
end
# ------------------------------------
def update
super
if $game_temp.battle_main_phase
self.contents_opacity -= 4 if self.contents_opacity > 191
else
self.contents_opacity += 4 if self.contents_opacity < 255
end
end
end


I messed around with the x/y's but still no dice.
 
Thanks Daniel, that did the trick. New problem though. :)

I want the picture to show on the far right side of the Battle Status Menu, but I'm only using a 2member party. Whenever I move the picture past the 2nd party-members info, that portion of the picture won't show. Do I need to create a new window on top of the BattleStatus Window, and if so how?

Sorry for being a scripting noob.
 

Juuhou

Sponsor

Instead of putting the code directly under self.contents.clear, put it under draw_actor_state and this should make the picture overlap everything, showing the whole picture...Im sure.
 

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