I'm having trouble disposing an image that is in a loop.
def draw_target_image @target_arrow.dispose if @target_arrow BattleManager.ctb_order.each_with_index do |i, index| if i[:name] == enemy.name if enemy.index @target_arrow = Sprite.new @target_arrow.bitmap = Cache.system "Target" @target_arrow.x = ((50 * index) + 6) + 274 @target_arrow.y = 380 @target_arrow.z = 100 end end endWhen I set @target_arrow.dispose, it only kills the last one made and the others stay in place.
How can I get them all to dispose?
def draw_target_image @target_arrow.dispose if @target_arrow BattleManager.ctb_order.each_with_index do |i, index| if i[:name] == enemy.name if enemy.index @target_arrow = Sprite.new @target_arrow.bitmap = Cache.system "Target" @target_arrow.x = ((50 * index) + 6) + 274 @target_arrow.y = 380 @target_arrow.z = 100 end end endWhen I set @target_arrow.dispose, it only kills the last one made and the others stay in place.
How can I get them all to dispose?