Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. from sys import exit
  2. from random import randrange
  3. import scene_list
  4.  
  5.                
  6. class Engine(object):
  7.     scenes = {
  8.         "Scene1": Scene1(),
  9.         "Scene2": Scene2(),
  10.         "Scene3": Scene3(),
  11.         "GameOver": GameOver(),
  12.         }
  13.        
  14.     def __init__(self, scene):
  15.         self.scene = scene
  16.        
  17.        
  18.     def first(self):
  19.         return self.next_scene(self.scene)
  20.    
  21.    
  22.     def following(self, next_scene):
  23.         value = Engine.scenes.get(next_scene)
  24.         return value
  25.        
  26.    
  27.     def play(self):
  28.         current = self.scene.first()
  29.         final = self.scene.following("GameOver")
  30.        
  31.         while current is not final:
  32.             scene = current.start()
  33.             current = self.scene.following(scene)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement