Esempio n. 1
0
    def __init__(self):
        Scene.__init__(self)

        self.addLayer(
            SceneLayer('office/wall.jpg', config.spriteLayers['sceneFar']))

        self.setFloor(.75)
Esempio n. 2
0
	def __init__( self ):
		Scene.__init__( self )

		self.addLayer( SceneLayer(
			'office/wall.jpg',
			config.spriteLayers['sceneFar']
		) )

		self.setFloor( .75 )
Esempio n. 3
0
	def __init__( self ):
		Scene.__init__( self )

		bg = SceneLayer(
			'dirt/dirt.png',
			config.spriteLayers['sceneFar']
		)
		bg.vector.y = config.settings['screen_h'] - bg.rect.height
		bg.vector.x = 0
		self.addLayer( bg )

		beetle = Beetle( Vector(
			0,
			config.settings['screen_h']
		))
		self.addActor( beetle )
Esempio n. 4
0
 def test_should_run_scenes(self):
     window = Window(800, 600, 'Test')
     scene = Scene(window)
     with unittest.mock.patch.object(scene, 'run', wraps=scene.run) as spy:
         window.add_scene(scene)
         window.run()
         spy.assert_called()
Esempio n. 5
0
def main():
    pyglet.resource.path.append('../data')
    pyglet.resource.reindex()

    entity_manager = EntityManager()
    block_grid = BlockGrid()

    state_update_phase = UpdatePhase()
    update_phases = [state_update_phase]
    update_manager = UpdateManager(update_phases)

    scene = Scene()
    camera = Camera(scale=5.0)
    game_window = GameWindow()
    collision_listener = GameCollisionListener()
    collision_world = CollisionWorld(listener=collision_listener)
    batch = pyglet.graphics.Batch()
    key_state_handler = pyglet.window.key.KeyStateHandler()
    joysticks = open_joysticks()
    block_entity_creator = BlockEntityCreator(collision_world, batch)
    character_entity_creator = CharacterEntityCreator(
        key_state_handler, joysticks, state_update_phase, collision_world,
        batch, block_entity_creator, entity_manager, block_grid)
    game_view = GameView(game_window, batch, key_state_handler, entity_manager,
                         update_manager, collision_world, collision_listener,
                         camera)
    game_window.view = game_view
    for i in xrange(-1, 2):
        position = float(i), 0.0
        block_entity = block_entity_creator.create(position=position)
        game_view.add_entity(block_entity)
    character_entity = character_entity_creator.create(position=(0.0, 2.0))
    game_view.add_entity(character_entity)
    pyglet.app.run()
Esempio n. 6
0
 def setUp(self) -> None:
     ball = Ball(pong.config.white, 10)
     engine = ComputerControlEngine(ball)
     self.left_player = Player('left', 'left', engine)
     self.right_player = Player('right', 'right', engine)
     self.score_manager = ScoreManager(self.left_player, self.right_player,
                                       (1, 5))
     self.score_board = ScoreBoard(self.score_manager)
     self.scene = Scene(Window(100, 100, 'Test'))
Esempio n. 7
0
 def test_should_allow_play_again(self):
     window = Window(800, 600, 'Test')
     play_again_scene = Scene(window)
     with unittest.mock.patch.object(play_again_scene, 'run', wraps=play_again_scene.run, side_effect=[1, 0]) as spy:
         window.add_scene(play_again_scene)
         self.assertEqual(0, window.run())
Esempio n. 8
0
 def test_should_exit_with_error(self):
     window = Window(800, 600, 'Test')
     error_scene = Scene(window)
     with unittest.mock.patch.object(error_scene, 'run', wraps=error_scene.run, return_value=-1) as spy:
         window.add_scene(error_scene)
         self.assertEqual(-1, window.run())
Esempio n. 9
0
 def test_should_add_scenes(self):
     window = Window(800, 600, 'Test')
     window.add_scene(Scene(window))
     self.assertEqual(1, len(window.scenes))
Esempio n. 10
0
	def __init__( self, verticalSpeed=0 ):
		Scene.__init__( self )
		UpdateableGameObject.__init__( self )

		self.timingCallbacks = []
Esempio n. 11
0
 def test_should_run_fine(self):
     window = pong.app.window.Window(800, 600, 'Test')
     scene = Scene(window)
     self.assertEqual(0, scene.run())
Esempio n. 12
0
	def __init__( self, verticalSpeed=0 ):
		Scene.__init__( self )
		UpdateableGameObject.__init__( self )

		self.verticalSpeed = verticalSpeed