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] Trouble with sprites/bitmaps

I have been working on a game in RMXP, that does NOT use the default systems(Game_Whatever, Scene_Whatever), and I have in the past been able to display a bitmap on the screen with this:

Code:
 

sprite = Sprite.new

sprite.bitmap = Bitmap.new(640,480)

sprite.bitmap.draw_text(5,5,144,32,"Hello World!")

 
but it hasn't been working on my new computer.

my code is:

Code:
 

begin

  # Prepare for transition

  Graphics.freeze

  sprite = Sprite.new(Viewport.new(0, 0, 640, 480))

  sprite.bitmap = Bitmap.new(640, 480) #RPG::Cache.icon('001-Weapon01')

  sprite.bitmap.draw_text(0,0,144,32,"Hello world!")

  sprite.x = sprite.y = 200

  loaded = 0

  loop do

    Graphics.update

    loaded += 1

    #break if loaded > 999

  end

  # Make scene object (title screen)

  #$scene = Scene_Title.new

  # Call main method as long as $scene is effective

  while $scene != nil

    $scene.main

  end

  # Fade out

  Graphics.transition(20)

rescue Errno::ENOENT

  # Supplement Errno::ENOENT exception

  # If unable to open file, display message and end

  filename = $!.message.sub("No such file or directory - ", "")

  print("Unable to find file #{filename}.")

end

 

I got it now. Wanna see what this helped me do?
Find it here: click here
 
You may have a japanese dll(RGSS102J.dll), which makes the default font to be one in japanese. Use a english dll(RGSS102E), or try using at the start of main:
Code:
Font.default_name = "Arial"

Or maybe "Graphics.freeze" is freezing the screen, and you need to call Graphics.transition to unfreeze the screen and the graphics to be updated. I don't remember well how freeze worked, but try adding Graphics.transition before the loop do.
 

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