Source code for rubato.classes.component

"""A component gives functionally to sprites."""
from typing import List, Union, TYPE_CHECKING

if TYPE_CHECKING:
    from rubato.classes.sprite import Sprite


[docs]class Component: """ A base component. Does nothing by itself. Attributes: sprite (Sprite): The sprite this component is attached to. required (List[type]): A list of components that are required by this component. (For example, a RigidBody needs a Hitbox). not_allowed(List[type]): A list of components that cannot be on the same Sprite. (For example, an Animation and an Image cannot be on the same Sprite) """
[docs] def __init__(self) -> None: """Initializes a component""" self.sprite: Union["Sprite", None] = None self.required: List[str] = [] self.not_allowed: List[str] = []
[docs] def draw(self) -> None: """The draw loop""" pass
[docs] def update(self) -> None: """ The main update loop for the component. """ pass
[docs] def setup(self) -> None: """ Run after initialization and before update loop begins """ pass
[docs] def fixed_update(self): """The fixed update loop""" pass