pub struct Entity { /* private fields */ }
Expand description
An Entity can be nearly anything. A field, a wall, a creature. It has values to allow interactions to intermingle. Maybe walls can be teleported, or broken down. Maybe someone can capture a creature and use it later on.
Implementations§
Source§impl Entity
Implementations for Entity that create standard default entities, such as,
impl Entity
Implementations for Entity that create standard default entities, such as,
- Player
- Specific Enemies
- Walls
Sourcepub fn new_player(x: i32, y: i32) -> Entity
pub fn new_player(x: i32, y: i32) -> Entity
Creates a good default player. Asks for a position.
Sourcepub fn new_slimer_entity(x: i32, y: i32) -> Entity
pub fn new_slimer_entity(x: i32, y: i32) -> Entity
Creates an evil slimer entity.
Source§impl Entity
Implementations of movement for the entity.
impl Entity
Implementations of movement for the entity.
Sourcepub fn get_move(&self, movement: Point) -> Rectangle
pub fn get_move(&self, movement: Point) -> Rectangle
Returns a rectangle of the entity if it moved by movement amount.
Sourcepub fn get_move_left(&self) -> Rectangle
pub fn get_move_left(&self) -> Rectangle
Returns movement if the entity moved 1 left.
Sourcepub fn get_move_right(&self) -> Rectangle
pub fn get_move_right(&self) -> Rectangle
Returns movement if the entity moved 1 right.
Sourcepub fn get_move_up(&self) -> Rectangle
pub fn get_move_up(&self) -> Rectangle
Returns movement if the entity moved 1 up.
Sourcepub fn get_move_down(&self) -> Rectangle
pub fn get_move_down(&self) -> Rectangle
Returns movement if the entity moved 1 down.
Sourcepub fn move_left(&mut self)
pub fn move_left(&mut self)
Moves the entity one left. Should usually be used with get_move_left first. May be removed in future versions.
Sourcepub fn move_right(&mut self)
pub fn move_right(&mut self)
Moves the entity one right. Should usually be used with get_move_right first. May be removed in future versions.
Source§impl Entity
impl Entity
Sourcepub fn new() -> EntityBuilder
pub fn new() -> EntityBuilder
Creates an instance of EntityBuilder to start building and Entity.
Sourcepub fn get_position(&self) -> Point
pub fn get_position(&self) -> Point
Returns the current position of the entity.
Sourcepub fn get_rectangle(&self) -> Rectangle
pub fn get_rectangle(&self) -> Rectangle
Returns both the size and position of an entity using a Rectangle.
Sourcepub fn get_abilities(&self) -> &Abilities
pub fn get_abilities(&self) -> &Abilities
Returns a reference to the abilities of an entity.