📦 JEEntity
Technical reference for the
JEEntityclass of JarEngine.
Inherit from
•>JEInternGraphicalObject<•📎 and•>JEInternOwnership<•📎
🔹 Overview
JEEntity is responsible for representing every interactive object that exists inside a JarEngine game.
Provides:
- Component-based architecture for building game objects.
- Unified interface for graphics, physics, audio, transforms, and custom behaviors.
- Deep-copy support and automatic integration with JarEngine systems.
JEEntity is the foundation of JarEngine’s Entity Component System (ECS). Rather than inheriting specialized classes, entities are composed by attaching components that define their capabilities. Systems then iterate over entities and update only the components they require, making entities lightweight, modular, extensible, and reusable across different projects.
🔹 Location
JarEngine
│
├── entity
│ └── JEEntity
│
└── ...
🔹 Data
| Field | Type | Description | Property? | Can be set? |
|---|---|---|---|---|
components |
JEContainer[JEInternEntityComponent] |
Collection of every component attached to the entity. | True | False |
🔹 API
| Function | Arguments | Returns | Description |
|---|---|---|---|
__init__ |
name: str = "JEEntity" |
 | Creates a new entity with the specified name. |
add_component |
component: JEInternEntityComponent |
 | Attaches a component to the entity. |
get |
component: type |
JEInternEntityComponent |
Retrieves the first component matching the specified type. |
copy |
 | JEEntity |
Creates a complete deep copy of the entity and all its components. |
| Component | Function | Arguments | Returns | Description |
|---|---|---|---|---|
| Surface | set_surface |
surface: PyGame.Surface |
 | Sets the entity surface. |
| Â | get_surface |
 | PyGame.Surface |
Returns the entity surface. |
| Font | set_font |
font: JEFont |
 | Sets the entity font resource. |
| Â | get_font |
 | JEFont |
Returns the entity font resource. |
| Text | set_text |
text: str |
 | Sets the displayed text. |
| Â | get_text |
 | str |
Returns the displayed text. |
| Texture | set_texture |
texture: JETexture |
 | Sets the entity texture resource. |
| Â | get_texture |
 | JETexture |
Returns the entity texture resource. |
| Color | set_color |
color: JEColor \| tuple[int, int, int] \| tuple[int, int, int, int] |
 | Sets the entity color. |
| Â | update_color |
r: int, g: int, b: int, a: int |
 | Updates the current entity color. |
| Â | get_color |
 | JEColor |
Returns the entity color. |
| Outline | set_outline_color |
color: JEColor \| tuple[int, int, int] \| tuple[int, int, int, int] |
 | Sets the outline color. |
| Â | update_outline_color |
r: int, g: int, b: int, a: int |
 | Updates the current outline color. |
| Â | get_outline_color |
 | JEColor |
Returns the outline color. |
| Â | set_outline_size |
size: int |
 | Sets the outline thickness. |
| Â | update_outline_size |
s: int |
 | Updates the current outline thickness. |
| Â | get_outline_size |
 | int |
Returns the outline thickness. |
| Visibility | set_visibility |
visibility: JEBool |
 | Sets the entity visibility. |
| Â | get_visibility |
 | JEBool |
Returns the entity visibility. |
| Layer | set_layer |
layer: int |
 | Sets the rendering layer. |
| Â | update_layer |
l: int |
 | Updates the current rendering layer. |
| Â | get_layer |
 | int |
Returns the rendering layer. |
| Flip | set_flip |
flip: tuple[JEBool, JEBool] |
 | Sets the sprite flip state. |
| Â | get_flip |
 | tuple[JEBool, JEBool] |
Returns the sprite flip state. |
| Music | set_music |
music: JEMusic |
 | Sets the music resource. |
| Â | play_music |
loop: int |
 | Plays the music resource. |
| Â | pause_music |
 |  | Pauses the music playback. |
| Â | resume_music |
 |  | Resumes the music playback. |
| Â | stop_music |
 |  | Stops the music playback. |
| Â | set_music_volume |
volume: int |
 | Sets the music volume. |
| Â | get_music |
 | JEMusic |
Returns the music resource. |
| Sound | set_sound |
sound: JESound |
 | Sets the sound resource. |
| Â | play_sound |
loop: int |
 | Plays the sound resource. |
| Â | stop_sound |
 |  | Stops the sound playback. |
| Â | pause_sound |
 |  | Pauses the sound playback. |
| Â | resume_sound |
 |  | Resumes the sound playback. |
| Â | fade_sound |
milliseconds: int |
 | Fades out the sound over the specified duration. |
| Â | set_sound_volume |
volume: int |
 | Sets the sound volume. |
| Â | get_sound |
 | JESound |
Returns the sound resource. |
| Acceleration | set_acceleration |
acceleration: JEVector2D \| tuple[float, float] |
 | Sets the entity acceleration. |
| Â | update_acceleration |
x: float, y: float |
 | Updates the current acceleration. |
| Â | get_acceleration |
 | JEVector2D |
Returns the entity acceleration. |
| Mass | set_mass |
mass: float |
 | Sets the entity mass. |
| Â | update_mass |
m: float |
 | Updates the current mass. |
| Â | get_mass |
 | float |
Returns the entity mass. |
| Position | set_position |
position: JEVector2D \| tuple[float, float] |
 | Sets the entity position. |
| Â | update_position |
x: float, y: float |
 | Updates the current position. |
| Â | get_position |
 | JEVector2D |
Returns the entity position. |
| Velocity | set_velocity |
velocity: JEVector2D \| tuple[float, float] |
 | Sets the entity velocity. |
| Â | update_velocity |
x: float, y: float |
 | Updates the current velocity. |
| Â | get_velocity |
 | JEVector2D |
Returns the entity velocity. |
| Size | set_size |
size: JEVector2D \| tuple[float, float] |
 | Sets the entity size. |
| Â | update_size |
x: float, y: float |
 | Updates the current size. |
| Â | get_size |
 | JEVector2D |
Returns the entity size. |
| Rotation | set_rotation |
rotation: float |
 | Sets the entity rotation in degrees. |
| Â | update_rotation |
r: float |
 | Updates the current rotation. |
| Â | get_rotation |
 | float |
Returns the entity rotation in degrees. |
| Group | group_add |
entity: JEEntity |
 | Adds an entity to the group. |
| Â | group_remove |
entity: JEEntity |
 | Removes an entity from the group. |
| Â | get_group |
 | JEContainer[JEEntity] |
Returns the entity group. |
🔹 Usage
from jarengine.entity.entity import JEEntity
from jarengine.components.position import JEPositionComponent
from jarengine.components.velocity import JEVelocityComponent
player = JEEntity(name="Player")
player.add_component(JEPositionComponent())
player.add_component(JEVelocityComponent())
position = player.get(JEPositionComponent)
clone = player.copy()