GameObject
This class is the base class for all in-world objects in the engine.
Attributes
SCALE(int): How much to scale all GameObjects by (do not set directly, useGameObject.set_scale)SHADOWS(dict[str, pg.Surface]): Dictionary of shadow images, loaded automatically once you instantiate aGameObject. DO NOT MODIFY MANUALLY.SUBPIXEL(bool): Whether to use subpixel rendering or not. You must set it at the class level.VELOCITY_DEADZONE(float): Minimum magnitude forvelocitybefore it gets set to(0, 0).CAUSES_COLLISONS(bool): Can thisGameObjectcause otherGameObjectsto collide with it?position(pg.Vector2): Current world-space position of theGameObject.velocity(pg.Vector2): Current world-space velocity of theGameObject.elevation(int): Current world-space elevation of theGameObject.z(float): Current world-space z-position of theGameObject.z_vel(float): Current world-space z-velocity of theGameObject.gravity(float): World-space gravity of theGameObject.height(float): World-space height of theGameObject.frame(float): Current animation frame.anim_speed(float): Animation speed.current_animation(str): Current animation.obj_shadow(str|None): Shadow size being used (or None for no shadow).colliders(list[pg.Rect|pg.FRect]): List of hitboxes relative to theGameObject.hitboxes(list[pg.Rect|pg.FRect]): List of world-space hitboxes in the current frame.current_frame(pg.Surface): Current animation frame surface.image(pg.Surface): Image for drawing (includescurrent_frameand the shadow).rect(pg.Rect|pg.FRect): Rect object for drawing.draw_index(tuple[float]): Sorting index for drawing.