Code:
class Window_Coin < Window_Base
def initialize(x,y,w,h)
super
@timer = 0
@frame = 0
end
def draw_animation
@sprite = Sprite.new
case @frame
when 0
self.contents.clear
@sprite.bitmap = Cache.pictures("ci_1.png")
when 1
self.contents.clear
@sprite.bitmap = Cache.pictures("ci_2.png")
when 2
self.contents.clear
@sprite.bitmap = Cache.pictures("ci_3.png")
when 3
self.contents.clear
@sprite.bitmap = Cache.pictures("ci_4.png")
when 4
self.contents.clear
@sprite.bitmap = Cache.pictures("ci_5.png")
when 5
self.contents.clear
@sprite.bitmap = Cache.pictures("ci_6.png")
when 6
self.contents.clear
@sprite.bitmap = Cache.pictures("ci_7.png")
end
@sprite.x = 0
@sprite.y = 0
end
def update
super
@timer += 1
@frame += 1 if @timer == 60 || @timer == 120
draw_animation if @timer == 60 || @timer == 120
@timer = 0 if @timer == 121
self.dispose if @frame == 6 && (@timer == 60 || @timer == 120)
end
end
$title_on = true
DataManager.init
def updates
Graphics.update
Input.update
$window2.update unless $window2.disposed?
end
$window2 = Window_Coin.new(100,Graphics.hieght/2,160,72) if $window1.disposed?
updates while $title_onI have looked through it for missing end statements, and cannot find any. I'm sure it's a really simple fix. I am certain all the graphics are where they belong in the project folders. I've tried several workarounds, as soon that I make this window_coin it breaks. any help is much appreciated.
EDIT
I isolated the problems, now my entire sequence works. However, I'm having issues disposing the bitmaps for the sprites.
Code:
this is my method for disposing the last sprite bitmap. according to all google searches this should destroy the last bitmap to allow me to create a new sprite instance with a new image.@sprite.dispose
@sprite = nil