Object

Struct Object 

Source
pub struct Object {
    pub pos: Vector,
    pub spd: Vector,
    pub rem: Vector,
    pub spr: u8,
    pub hitbox: Rectangle,
    pub flip: FlipState,
    pub collidable: bool,
    pub solids: bool,
    pub obj_type: ObjectType,
    pub draw: ObjFunc,
    pub update: ObjFunc,
    pub name: &'static str,
}

Fields§

§pos: Vector§spd: Vector§rem: Vector§spr: u8§hitbox: Rectangle§flip: FlipState§collidable: bool§solids: bool§obj_type: ObjectType§draw: ObjFunc§update: ObjFunc§name: &'static str

Implementations§

Source§

impl Object

Source

pub fn draw(&mut self, celeste: &mut Celeste)

Source

pub fn update(&mut self, celeste: &mut Celeste)

Source

pub fn left(&self) -> f32

Source

pub fn right(&self) -> f32

Source

pub fn top(&self) -> f32

Source

pub fn bottom(&self) -> f32

Source

pub fn init_smoke(&self, celeste: &mut Celeste, x: f32, y: f32)

Source

pub fn draw_sprite(&self, celeste: &mut Celeste)

Source

pub fn do_move(&mut self, celeste: &mut Celeste, ox: f32, oy: f32, start: f32)

Source

pub fn check( &mut self, celeste: &mut Celeste, name: &'static str, x: f32, y: f32, ) -> Option<usize>

Source

pub fn is_ice(&self, x: f32, y: f32, celeste: &mut Celeste) -> bool

Source

pub fn is_solid(&mut self, x: f32, y: f32, celeste: &mut Celeste) -> bool

Source

pub fn is_flag(&self, x: f32, y: f32, flag: u8, celeste: &mut Celeste) -> bool

Source

pub fn init_fruit(&mut self, celeste: &mut Celeste, ox: f32, oy: f32)

and then they turned themself into a strawberry. funniest shit i’ve ever seen

Source

pub fn destroy_self(&mut self, celeste: &mut Celeste)

WARNING: Only use this function if it is being called by the object itself in an update loop

Source

pub fn destroy_other(&mut self, celeste: &mut Celeste)

Trait Implementations§

Source§

impl<'de> Deserialize<'de> for Object

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Object

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Object

§

impl !RefUnwindSafe for Object

§

impl !Send for Object

§

impl !Sync for Object

§

impl Unpin for Object

§

impl !UnwindSafe for Object

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,