Example #1
0
 def __init__(self, x_pos, y_pos, width, height):
     txs = get_texture_loader()
     super().__init__(
         x_pos, y_pos, width, height,
         create_circle(x_pos, y_pos, (width / 2), 100, 0.3),
         txs.get_texture_by_name("ball")
     )
Example #2
0
    def __init__(self, x_pos, y_pos):
        txs = get_texture_loader()
        super().__init__(
            x_pos, y_pos, BLOCK_WIDTH, BLOCK_HEIGHT,
            create_circle(x_pos, y_pos, (BLOCK_WIDTH / 2), 100, 0.3),
            txs.get_texture_by_name("ball"))

        register_event_handler(self.key_press, InputEventType.KEY_PRESS)
Example #3
0
    def __init__(self):
        #: The main config
        self.config = get_config()
        #: Level loader
        self.levels = get_level_loader()
        #: Loads all textures
        self.textures = get_texture_loader()
        #: Deals with game audio
        self.audio = GameAudio()
        #: List of registered input handling functions
        self.input_handlers = {}
        #: True if dev mode is enabled
        self.dev_mode = self.config.is_development_mode()

        #: The game context
        self.ctx = None
        #: Vertex and fragment shader programs
        self.program = None
        #: Pymunk simulation space
        self.space = None
        #: The camera position
        self.camera = None
        #: The mouse position
        self.mouse_pos = None
        #: The entity manager. Has all entities to be rendered. Initialized in setup()
        self.entity_mgr = None
        #: The player
        self.player = None
        #: The frame buffer
        self.frame_buffer = None
        #: The vertex array
        self.vertex_array = None

        #: Total points
        self.total_points = 0
        #: Number of deaths (factors into final score)
        self.deaths = 0
        #: Window width (populated in setup())
        self.width = 0
        #: Window height (populated in setup())
        self.height = 0
        #: The amount to step the physics engine on each frame
        self.physics_step = 0
Example #4
0
 def __init__(self, x_pos, y_pos, width, height):
     txs = get_texture_loader()
     super().__init__(x_pos, y_pos, width, height,
                      create_static_box(x_pos, y_pos, width, height, 0.5),
                      txs.get_texture_by_name("floor"))
Example #5
0
 def __init__(self, x_pos, y_pos, width, height):
     txs = get_texture_loader()
     super().__init__(x_pos, y_pos, width, height,
                      create_box(x_pos, y_pos, width, height, 10, 0.3),
                      txs.get_texture_by_name("crate"))