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.

simple window question

Code:
class My_Window < Window_Base
  def initialize
    super(80,80,480,320)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    self.contents.font.color = normal_color
    refresh
  end #method
  def refresh
    self.contents.draw_text(4,4,120,32,"Look! Text")
    
    for i in 0...$game_party.actors.size
      x = i * 32 + 4
      y = 32
      actor = $game_party.actors[i]
      draw_actor_graphic(actor,x)
    end #for
  end #method
end #class

1) Am I doing anything wrong here? it's supposed to show a window with some text and then the heroes.

2) How would I call this?

I know, I suck in RGSS...
 
To call it, first go into the scene you want it in. Find the method "main" and add:

@window = My_Window.new

Then find the method "update" and add:

@window.update

Then, find the method "main" again, and under the loop add:

@window.dispose
 
to fix your script:
Code:
class My_Window < Window_Base
  def initialize
    super(80,80,480,320)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $fontface # this 2 lines make no sence,
    self.contents.font.size = $fontsize # used with the illegal translated version.
    self.contents.font.color = normal_color # this line can be removed, not needed.
    refresh
  end
  def refresh
    self.contents.clear  # Clear up contents on each refresh
    self.contents.draw_text(4,4,120,32,"Look! Text")
    for i in 0...$game_party.actors.size
      x = i * 32 + 4
      y = 32
      actor = $game_party.actors[i]
      draw_actor_graphic(actor,x, y) # You forgat the Y axis.
    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