Example #1
0
    def createCollision(self, x, y, width, height):
        """
        @x,y: standarized.
        """
        new_entity = self.entity_manager.createEntity()

        shape = helper.createCollision(x, y, width, height)
        shape.friction = STD_FRICTION
        shape.collision_type = COLLISION_C_TYPE
        new_physics_component = PhysicsComponent(shape)

        self.entity_manager.addComponent(new_entity, new_physics_component)

        self.group_manager.add(new_entity, 'collision')
        return new_entity
Example #2
0
    def createDeathZone(self, x, y, width, height):
        """
        Creates an invisible entity which is a rectangle.
        Used for detecting zones the player shouldn't be and thus making him
        die if he gets into any of those zones.
        @x,y: standarized.
        """
        new_entity = self.entity_manager.createEntity()

        shape = helper.createCollision(x, y, width, height)
        shape.collision_type = ENEMY_C_TYPE

        new_physics_component = PhysicsComponent(shape)

        self.entity_manager.addComponent(new_entity, new_physics_component)

        self.group_manager.add(new_entity, 'death_zone')
        return new_entity