RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
How to Set up a Multi-Scene Scene

0 Members and 1 Guest are viewing this topic.

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
Many people think it's complicated to write scenes such as scene_menu while including all of the scenes together in a single scene, and still keep it relatively lag free. It's not as hard as you would think. First, just have variables automaticly set to false, they turn true after you've introduced the scene. EX: Moved windows or changed visability ect.

And, like Scene_Battle, use an instance variable (scene as opposed to phase) to keep track of what scene you're on.

Here's an example template for creating a Scene_Menu -

Code: [Select]
class Scene_Menu

def initialize
@main = false
@items = false
@status = false
@spells = false
@equip = false
@file = false
@close = false
@scene = 0
end

def main
Graphics.transition
loop do
basic_update
update
break if not_scene
end
Graphics.freeze
dispose
end

def basic_update
Graphics.update
Input.update
end

def update
case @scene
when 0
update_main
when 1
update_items
when 2
update_status
when 3
update_spells
when 4
update_equip
when 5
update_file
when 6
update_close
end
end

def not_scene
return $scene != self
end

def dispose
self.instance_variables.each.do(|item|
if item.is_a?(Window) or item.is_a?(Sprite)
item.dispose
end)
end

def update_main
main_init if !@main
else
# Update main scene
end
end

def update_items
items_init if !@items
else
# Update item scene
end
end

def update_status
status_init if !@status
else
# Update status scene
end
end

def update_spells
spells_init if !@spells
else

end
end

def update_equip
equip_init if !@equip
else

end
end

def update_file
file_init if !@file
else

end
end

def update_close
close_init if !@close
else

end
end

def main_init
# Set up Scene for Main Scene
@main = true
end

def items_init
# Set up Scene for Items Scene
@items = true
end

def status_init
# Set up Scene for Status Scene
@status = true
end

def spells_init
# Set up Scene for Spells Scene
@spells = true
end

def equip_init
# Set up Scene for Equip Scene
@equip = true
end

def file_init
# Set up Scene for File Scene
@file = true
end

def close_init
# Set up Scene for Close Scene
@close = true
end

end

I'll explain the rest later, G2G.
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
Nice start. I always checked if the windows are nil and if not, I checked if they are active. That's how I did it.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
Thanks ^_^ .

How it Works

What it does is loop and run a basic update (Grahpics and Input) then it runs the update method.
The update method is the most important part of the idea, it checks what scene you are running and runs the particular update method for that scene.
You'll notice that there are variables set to false in the begining. You will also (in the branched update methods) see something along the lines of -

Code: [Select]
main_init if !@main
else

end

By putting if !@main, we are checking to see if @main equals false. What it will then run is the preceding method - main_init.

This is what the variables are for, to make sure the scene is initialized properly, and that it doesn't happen more than once.

All you have to do is create all of the windows before the main loop, and update each scene like you normaly would in their respective update method.

This should stay pretty lag free considering it will only run each scene if it's active.

To change the scene, you use -

Code: [Select]
@scene = A_NUMBER

The number reflects what scene it is. For example, in the given template the main scene (ie: the menu itself) is given the number 0.

This will work unless you for some reason dispose windows inside the scene itself.
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

*
I love Firerain
Rep:
Level 97
=D
Good...very good!
Arlen is hot.