I'm working on a menu HUD. I want to use an image backgrounds as opposed to using a windowskin. So, there will be one large image for the main background and then smaller images for separate "window" images. I've gotten it to work so that each image displays, but the first image (main background) will disappear when the second appears.
I saw nio's thread here, but I'm not sure if this needs to be my solution or if there is an easier way.
Any help would be greatly appreciated.
More than one image
● ARCHIVED · READ-ONLY
-
-
perhaps this small example code will help?
Code:class Scene_Whatever < Scene_Base def start super @bg = Sprite.new(@viewport) @bg.bitmap = Cache.system('background') @bg.x = 0 @bg.y = 0 @bg.z = 1 @lg = Sprite.new(@viewport) @lg.bitmap = Cache.system('logo') @lg.x = 0 @lg.y = 0 @lg.z = 1 end def terminate @bg.bitmap.dispose @bg.dispose @lg.bitmap.dispose @lg.dispose super end def update @bg.update @lg.update super end end -
Ahhh, super! That worked perfectly! Thank you!
And I assume for each image I need to show, I can just replicate that bit of code? (With different variable names, obviously.) -
That would be the easiest thing for learning I think. A more efficient way would be to have an array of sprites. :)
-
Which is what Nio's thread suggests. I think I will get this functioning for now and then maybe play around with the arrays. I really should conquer my fear of them. :)
This thread can be closed, as my problem is solved for now! -
Arrays arent scary..
Just grab them by the parenthesis and get it over with!!
Code:def cool_array a = [true]*2 b = Array.new(2) {false} c = { f: true, t: false}.values.reverse d = a + c + b << false return [*d, :epic, true]endprint cool_array