Celeste

Struct Celeste 

Source
pub struct Celeste {
Show 24 fields pub mem: Memory, pub objects: Vec<Rc<RefCell<Object>>>, pub got_fruit: Vec<bool>, pub max_djump: u8, pub deaths: u64, pub frames: u8, pub room: Vector, pub level: u8, pub has_dashed: bool, pub has_key: bool, pub freeze: u8, pub particles: Vec<Particle>, pub dead_particles: Vec<DeadParticle>, pub delay_restart: u8, pub shake: u8, pub seconds: u8, pub minutes: u64, pub clouds: Vec<Cloud>, pub start_game_flash: f32, pub music_timer: i32, pub start_game: bool, pub flash_bg: bool, pub new_bg: bool, pub pause_player: bool,
}

Fields§

§mem: Memory

Represents the pico-8 display buffers and memory. Go through this for any drawing

§objects: Vec<Rc<RefCell<Object>>>§got_fruit: Vec<bool>§max_djump: u8§deaths: u64§frames: u8§room: Vector§level: u8§has_dashed: bool§has_key: bool§freeze: u8§particles: Vec<Particle>§dead_particles: Vec<DeadParticle>§delay_restart: u8§shake: u8§seconds: u8§minutes: u64§clouds: Vec<Cloud>§start_game_flash: f32§music_timer: i32§start_game: bool§flash_bg: bool§new_bg: bool§pause_player: bool

Implementations§

Source§

impl Celeste

Source

pub fn new( map: String, sprites: String, flags: String, fontatlas: String, ) -> Celeste

Returns a new celeste object

§Arguments
  • map - A string containing the “mapdata” section of a pico-8 cart
  • sprites - A string containing the “sprites” section of the pico-8 cart
  • flags - A string containing the “flags” section of the pico-8 carts
  • fontatlas - A string with the bitmap data of the pico-8 font
§Examples
// see https://github.com/CoolElectronics/rustic-mountain/blob/main/standalone/src/consts.rs for example values of these constants
let celeste = Celeste::new(MAPDATA,SPRITES,FLAGS,FONTATLAS);
Source

pub fn next_tick(&mut self)

Advances a game tick. Does not draw the screen buffer. Analagous to calling _update() in the original pico-8 cart. Should be called 30 times a second for real-time gameplay

Source

pub fn is_title(&self) -> bool

Source

pub fn begin_game(&mut self)

Source

pub fn draw(&mut self)

Source

pub fn next_room(&mut self)

advances to the next room

Source

pub fn title_screen(&mut self)

Source

pub fn load_room(&mut self, x: u8, y: u8)

Source

pub fn tile_at(&self, x: f32, y: f32) -> u8

Source

pub fn spikes_at( &self, x1: f32, y1: f32, x2: f32, y2: f32, xspd: f32, yspd: f32, ) -> bool

Source

pub fn save_state(&mut self) -> Result<String, Error>

returns a savestate in JSON format, as a string

let savestate = celeste.save_state();
celeste.load_state(savestate)
Source

pub fn load_state(&mut self, json: &str)

loads a savestate in JSON format, as a string slice

let savestate = celeste.save_state();
celeste.load_state(savestate)

Trait Implementations§

Source§

impl<'de> Deserialize<'de> for Celeste

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 Celeste

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 Celeste

§

impl !RefUnwindSafe for Celeste

§

impl !Send for Celeste

§

impl !Sync for Celeste

§

impl Unpin for Celeste

§

impl !UnwindSafe for Celeste

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>,