Save-Point
A good way to make an interrupt scene - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Tutorials (https://www.save-point.org/forum-19.html)
+--- Thread: A good way to make an interrupt scene (/thread-1649.html)



A good way to make an interrupt scene - Ramiro - 11-20-2009

Hello im here to make a tip of an interrupt scene

What's an interrupt scene
Its an special scene than can be shown "inside" another scene (good to separate some thigs..., sometimes)

How can i make one?
It's not as hard as you can think, let me show how to make it.

First you need to add some variables in the scene you want to "insert" de scene.

example

Code:
class Your_Scene
def initialize
@interrupt_scene = nil
[more code]
end
end

Now the update part..
Code:
class Your_Scene
def update
if @interrupt_scene != nil
if @interrupt_scene.disposed?
@interrupt_scene = nil
else
@interrupt_scene.update
return
end
end
[more code]
end
end
And the last part: how to make the scene

Code:
class Your_new_scene
def initialize
@disposed = false
[your code]
end

def update
[your code]
end

def dispose
[your code]
end

def disposed?
return @disposed
end


end

And now the good part.
To call the scene:

@interrupt_scene = Your_scene.new
and to quit it. put in the scene:
@disposed = true

EXAMPLES FOR RPG MAKERS

[VX VERSION]
Content Hidden

[XP VERSION]

Content Hidden

to call the scene (on Scene_map in this example)

Put in an event as "insert script"

Code:
scene = Scene_Interrupt_Skill.new(0)
$scene.call_interrupt_scene(scene)


And that's all. see ya!


A good way to make an interrupt scene - s_miracle - 11-21-2009

Sounds like its exactly what I've been looking for, but I don't really understand how this works, can you please make a short demo project showing an example interrupt scene if its not too much trouble?


A good way to make an interrupt scene - Jaberwocky - 11-21-2009

It's just running another class' update method in place of the first class' update method.
In other words, it's using the current $scene's main method to update instead of having it's own main method.
Nothing special about it.


A good way to make an interrupt scene - Ramiro - 11-21-2009

Ok i made an XP example and a VX example to call the Scene Skill on map
Remember, it's just an example you can make anything you want with this.


A good way to make an interrupt scene - s_miracle - 11-22-2009

Thanks, I figured it all out :cheery: I'll be sure to credit you if I ever get this thing done