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.

Strange error...

I get the error "Undefined method 'Dispose'" with this script, but if I go into the script editor and just view the script before going into test play, I don't get the error...

Code:
#---------------
# Spriteset_Map
#---------------
class Spriteset_Map
  # Thanks to Daniel for this
  alias icon_init initialize
  alias icon_dispose dispose
  def initialize
    icon_init
    bitmap = Bitmap.new(250, 32)
    unless $game_party.actors[0].weapon_id == 0
      icon = $data_weapons[$game_party.actors[0].weapon_id].icon_name
      bitmap.blt(0, 0, RPG::Cache.icon(icon), Rect.new(0, 0, 24, 24))
    end
    for i in 1..4
      case i
      when 1
        next if $game_party.actors[0].armor1_id == 0
        icon = $data_armors[$game_party.actors[0].armor1_id].icon_name
      when 2
        next if $game_party.actors[0].armor2_id == 0
        icon = $data_armors[$game_party.actors[0].armor2_id].icon_name
      when 3
        next if $game_party.actors[0].armor3_id == 0
        icon = $data_armors[$game_party.actors[0].armor3_id].icon_name
      when 4
        next if $game_party.actors[0].armor4_id == 0
        icon = $data_armors[$game_party.actors[0].armor4_id].icon_name
      end
      bitmap.blt(i*51, 0, RPG::Cache.icon(icon), Rect.new(0, 0, 24, 24))
    end
    @icon_sprite = Sprite.new
    @icon_sprite.bitmap = bitmap
    @icon_sprite.x = 222
    @icon_sprite.y = 417
    @icon_sprite.z = 500
  end
  def dispose
    icon_dispose
    @icon_sprite.dispose
  end
end

The error is here:

@icon_sprite.dispose
 

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