I've played around with it a bit and can't figure out how to switch between two Scenes, say for example as a result of a touch.
In other words if i've got two scenes and a scene viewer like in this simple example, what would be a possible/recommended way of switching from one to the other?
import scene, ui
class MyScene1(scene.Scene):
def draw(self):
scene.background(0, 0, 0)
scene.fill(0, 0, 1)
for touch in self.touches.values():
scene.ellipse(touch.location.x - 50,
touch.location.y - 50, 100, 100)
class MyScene2(scene.Scene):
def draw(self):
scene.background(0, 0, 0)
scene.fill(1, 0, 1)
for touch in self.touches.values():
scene.rect(touch.location.x - 50,
touch.location.y - 50, 100, 100)
class SceneViewer(ui.View):
def __init__(self, in_scene):
self.present()
self.scene_view = scene.SceneView(frame=self.bounds)
self.scene_view.scene = in_scene
self.add_subview(self.scene_view)
def draw(self):
... Switching code to MyScene2 here? .....
def touch_ended(self,touch):
...Switching code to MyScene2 here?...
SceneViewer(MyScene())
Thanks for your help !!