[][src]Struct tiny_rpg::entity::Entity

pub struct Entity { /* fields omitted */ }

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.

Methods

impl Entity[src]

Implementations for Entity that create standard default entities, such as,

  • Player
  • Specific Enemies
  • Walls

pub fn new_player(x: i32, y: i32) -> Entity[src]

Creates a good default player. Asks for a position.

pub fn new_slimer_entity(x: i32, y: i32) -> Entity[src]

Creates an evil slimer entity.

pub fn new_wall(x: i32, y: i32, height: u32, width: u32) -> Entity[src]

Creates a wall where you specify height, width and position.

impl Entity[src]

Implementations of movement for the entity.

pub fn get_move(&self, movement: Point) -> Rectangle[src]

Returns a rectangle of the entity if it moved by movement amount.

pub fn get_move_left(&self) -> Rectangle[src]

Returns movement if the entity moved 1 left.

pub fn get_move_right(&self) -> Rectangle[src]

Returns movement if the entity moved 1 right.

pub fn get_move_up(&self) -> Rectangle[src]

Returns movement if the entity moved 1 up.

pub fn get_move_down(&self) -> Rectangle[src]

Returns movement if the entity moved 1 down.

pub fn move_left(&mut self)[src]

Moves the entity one left. Should usually be used with get_move_left first. May be removed in future versions.

pub fn move_right(&mut self)[src]

Moves the entity one right. Should usually be used with get_move_right first. May be removed in future versions.

pub fn move_up(&mut self)[src]

Moves the entity one up. Should usually be used with get_move_up first. May be removed in future versions.

pub fn move_down(&mut self)[src]

Moves the entity one down. Should usually be used with get_move_down first. May be removed in future versions.

impl Entity[src]

pub fn new() -> EntityBuilder[src]

Creates an instance of EntityBuilder to start building and Entity.

pub fn get_position(&self) -> Point[src]

Returns the current position of the entity.

pub fn get_size(&self) -> Dimension[src]

Returns the size of the entity.

pub fn get_rectangle(&self) -> Rectangle[src]

Returns both the size and position of an entity using a Rectangle.

pub fn get_skin(&self) -> Skin[src]

Returns the skin of the entity.

pub fn get_abilities(&self) -> &Abilities[src]

Returns a reference to the abilities of an entity.

impl Entity[src]

AI logic here. Should only need to call perform_turn for the object to do what it thinks is best. Almost certainly will become a trait.

pub fn perform_turn(&mut self, data: &mut Data)[src]

The entity performs an action based on its environment.

Trait Implementations

impl Clone for Entity[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialEq<Entity> for Entity[src]

impl Debug for Entity[src]

Auto Trait Implementations

impl Sync for Entity

impl Send for Entity

impl Unpin for Entity

impl RefUnwindSafe for Entity

impl UnwindSafe for Entity

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]