(important note: I got the topic title wrong. Should be "Disposed Sprite")
Still fairly new to Ruby here. I suspect I've gone about this completely backwards, but...
I've been working on a script to display images on the background of menus. It's working pretty well.
Character select screen after picking Skills. The image of the current character smoothly moves to the centre while the others move to the bottom.
Battle status window. Characters' heads move up when they are picking an action or executing an action.
However, I'd like to make it more useful - I can't tint, rotate or zoom. The script works by creating some sprites inside the window class (eg window_actor) and drawing them to a buffer bitmap (@backgroundimg) which is then drawn to contents before anything else in the window is. I'm only going to quote the code I think is pertinent but ask if you want to see more.
Currently, when an window with animated elements appears, there is something like this in its initialise routine
which means "initialise the special Background settings and create an image at 0, 0. Use the "ritaNecroSideFace" graphic, it's alpha value is 255." That image can later be access later and told to move elsewhere much like a picture. You can see the result in the top left of the first screenshot (though its y value has changed)
Sprite_Menuback is a class I created to hold the image's data. It's pretty much a clone of Sprite_Picture but with everything I thought it didn't need stripped out. Specifically it does not refer to a Game_Picture object but holds all its own variables.
Pastebin of Sprite_Menuback
So here's the problem. I was hoping that making Sprite_Menuback inherit Sprite_base would give me access to all its fancy stuff like tinting and rotation. However any attempt to use, for example, self.tone makes the game crash with the error message "Disposed Sprite," and I can't find any other way to tint the image. (I had some success with Hue, but it's not the fine control I wanted)
Does anyone have any idea why? This has me foxed, the only thing I know for sure is that dispose function is never getting called, so it's not that.
Still fairly new to Ruby here. I suspect I've gone about this completely backwards, but...
I've been working on a script to display images on the background of menus. It's working pretty well.
Character select screen after picking Skills. The image of the current character smoothly moves to the centre while the others move to the bottom.
Battle status window. Characters' heads move up when they are picking an action or executing an action.
However, I'd like to make it more useful - I can't tint, rotate or zoom. The script works by creating some sprites inside the window class (eg window_actor) and drawing them to a buffer bitmap (@backgroundimg) which is then drawn to contents before anything else in the window is. I'm only going to quote the code I think is pertinent but ask if you want to see more.
Currently, when an window with animated elements appears, there is something like this in its initialise routine
Code:
window_menucommand #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0) initialise_specialBG n=0 @images[n]=Sprite_MenuBack.new(0,0,"ritaNecroSideFace",255) select_last end
which means "initialise the special Background settings and create an image at 0, 0. Use the "ritaNecroSideFace" graphic, it's alpha value is 255." That image can later be access later and told to move elsewhere much like a picture. You can see the result in the top left of the first screenshot (though its y value has changed)
Sprite_Menuback is a class I created to hold the image's data. It's pretty much a clone of Sprite_Picture but with everything I thought it didn't need stripped out. Specifically it does not refer to a Game_Picture object but holds all its own variables.
Pastebin of Sprite_Menuback
So here's the problem. I was hoping that making Sprite_Menuback inherit Sprite_base would give me access to all its fancy stuff like tinting and rotation. However any attempt to use, for example, self.tone makes the game crash with the error message "Disposed Sprite," and I can't find any other way to tint the image. (I had some success with Hue, but it's not the fine control I wanted)
Does anyone have any idea why? This has me foxed, the only thing I know for sure is that dispose function is never getting called, so it's not that.