Skip to main content

Tuning

Struct Tuning 

Source
pub struct Tuning {
Show 78 fields pub size: (i32, i32), pub run_speed: f32, pub sprint: bool, pub sprint_speed: f32, pub run_accel: f32, pub turn_accel: f32, pub run_decel: f32, pub overspeed_decel: f32, pub air_control: f32, pub gravity: f32, pub fall_gravity: f32, pub apex_threshold: f32, pub apex_gravity: f32, pub max_fall: f32, pub fast_fall: f32, pub jump_speed: f32, pub jump_boost: f32, pub var_jump_time: f32, pub jump_cut: f32, pub coyote_time: f32, pub jump_buffer: f32, pub drop_through_time: f32, pub air_jumps: u8, pub double_jump_speed: f32, pub double_var_jump_time: f32, pub land_jump_lookahead: i32, pub dashes: u8, pub dash_eight_way: bool, pub dash_speed: f32, pub dash_time: f32, pub dash_end_speed: f32, pub dash_end_up: f32, pub dash_cooldown: f32, pub dash_buffer: f32, pub dash_recharge_after: f32, pub crystal_respawn: f32, pub grab: bool, pub slip_speed: f32, pub tired_stamina: f32, pub tired_slip_speed: f32, pub stamina: f32, pub climb_up_speed: f32, pub climb_down_speed: f32, pub climb_up_cost: f32, pub climb_still_cost: f32, pub climb_jump_cost: f32, pub climb_hop_speed: f32, pub wall_slide_speed: f32, pub wall_jump_speed: f32, pub wall_jump_lock: f32, pub wall_jump_reach: i32, pub wall_climb_speed: f32, pub wall_climb_lock: f32, pub wall_jump_aim: f32, pub wall_refills_air_jumps: bool, pub wall_refills_dashes: bool, pub wall_stick_time: f32, pub dive: bool, pub glide: bool, pub glide_fall_speed: f32, pub super_dash: bool, pub super_charge: f32, pub super_speed: f32, pub super_cancel_speed: f32, pub run_roll: bool, pub run_roll_speed: f32, pub wings: bool, pub dive_windup: f32, pub dive_speed: f32, pub dive_land_time: f32, pub roll_drop: i32, pub roll_speed: f32, pub roll_time: f32, pub roll_jump_after: f32, pub hard_land_drop: i32, pub hard_land_time: f32, pub corner_correction: i32, pub lift_boost: f32,
}
Expand description

The movement feel. All lengths in units, speeds units/s, accelerations units/s², times seconds.

Fields§

§size: (i32, i32)

The hitbox’s width and height in units (default 6x12, super::player::W x super::player::H). The other numbers stay in units and don’t scale with it: tuned for a 6x12 body on 8-unit tiles, a much bigger body may want a higher jump.

§run_speed: f32

Top running speed.

§sprint: bool

A sprint button exists.

§sprint_speed: f32

Top speed while sprinting.

§run_accel: f32

Acceleration toward the stick’s speed on the ground.

§turn_accel: f32

Acceleration when the stick points against the motion (turning around).

§run_decel: f32

Deceleration with the stick released.

§overspeed_decel: f32

Deceleration toward top speed when moving faster than it (after a roll jump or a dash), so momentum carries.

§air_control: f32

Multiplier on all horizontal acceleration in the air.

§gravity: f32

Gravity.

§fall_gravity: f32

Gravity multiplier while falling, for a heavier way down.

§apex_threshold: f32

Below this vertical speed (either way) with jump held, the hero is “at the apex”.

§apex_gravity: f32

Gravity multiplier at the apex with jump held: the hangtime.

§max_fall: f32

Terminal falling speed.

§fast_fall: f32

Terminal falling speed with down held.

§jump_speed: f32

Upward speed of a ground jump.

§jump_boost: f32

Horizontal speed added by a ground jump in the stick’s direction.

§var_jump_time: f32

Seconds after a jump during which holding jump keeps the full upward speed.

§jump_cut: f32

Releasing jump while rising multiplies the upward speed by this (1: no cut).

§coyote_time: f32

Seconds after leaving a ledge during which a ground jump still works.

§jump_buffer: f32

Seconds a jump press waits for the jump to become possible.

§drop_through_time: f32

Seconds after dropping through a platform during which platforms don’t hold.

§air_jumps: u8

Jumps available in the air before landing again.

§double_jump_speed: f32

Upward speed of an air jump.

§double_var_jump_time: f32

Hold window of an air jump, like Tuning::var_jump_time.

§land_jump_lookahead: i32

Falling with ground this many units below, a jump press waits for the landing (a queued ground jump) instead of spending the air jump.

§dashes: u8

Dashes available before touching ground or a crystal again (0: no dash).

§dash_eight_way: bool

Dashes go eight ways; otherwise only sideways.

§dash_speed: f32

Speed during a dash.

§dash_time: f32

Length of a dash.

§dash_end_speed: f32

Speed handed over when a dash ends.

§dash_end_up: f32

Multiplier on the handed-over speed of upward dashes.

§dash_cooldown: f32

Seconds after a dash starts before another one can.

§dash_buffer: f32

Seconds a dash press waits for a dash to become possible.

§dash_recharge_after: f32

Seconds into a dash before the ground refills dashes (so dashing along the floor isn’t free).

§crystal_respawn: f32

Seconds before a used crystal comes back.

§grab: bool

Grabbing walls and climbing is possible at all.

§slip_speed: f32

Holding still on a wall slides down at this speed: 0 holds firm, more is a grip that slips.

§tired_stamina: f32

Below this stamina even a firm grip slips, at Tuning::tired_slip_speed.

§tired_slip_speed: f32

How fast a tired grip slips.

§stamina: f32

Stamina when full; climbing spends it, the ground refills it.

§climb_up_speed: f32

Climbing speed up a wall.

§climb_down_speed: f32

Climbing speed down a wall.

§climb_up_cost: f32

Stamina per second climbing up.

§climb_still_cost: f32

Stamina per second holding still on a wall.

§climb_jump_cost: f32

Stamina for a jump straight up a wall.

§climb_hop_speed: f32

Upward speed of the hop over the top of a wall.

§wall_slide_speed: f32

Terminal falling speed pressing into a wall without grabbing.

§wall_jump_speed: f32

Horizontal speed of a wall jump.

§wall_jump_lock: f32

Seconds after a wall jump during which the stick can’t pull back to the wall.

§wall_jump_reach: i32

A wall this many units away still counts for a wall jump.

§wall_climb_speed: f32

Horizontal speed of a wall jump made holding toward the wall: small, so the hero arcs back onto the same wall (Hollow Knight, Super Meat Boy). Equal to Tuning::wall_jump_speed to turn it off.

§wall_climb_lock: f32

Stick lock of such a wall jump. Between toward and away, speed and lock blend.

§wall_jump_aim: f32

How much stick up or down tilts a wall jump’s upward speed (0.15: +-15 %).

§wall_refills_air_jumps: bool

Touching a wall (sliding or holding on) gives the air jumps back.

§wall_refills_dashes: bool

Touching a wall gives the dashes back too.

§wall_stick_time: f32

Sliding down a wall, pressing away keeps the hero stuck to it this long, so “away + jump” becomes a wall jump instead of a fall.

§dive: bool

Diving is possible at all.

§glide: bool

Gliding: a jump pressed in the air and held (after the air jump, if one is left) opens a cloak once falling.

§glide_fall_speed: f32

Terminal falling speed gliding.

§super_dash: bool

Super dash (Hollow Knight’s Crystal Heart): hold to charge on the ground or on a wall, release when charged to fly straight and level until a wall or a cancel.

§super_charge: f32

Seconds to charge it.

§super_speed: f32

Flying speed.

§super_cancel_speed: f32

Horizontal speed kept when the flight is cancelled (jump or the button again).

§run_roll: bool

Tapping down while running at speed rolls.

§run_roll_speed: f32

Horizontal speed needed for a roll from a run.

§wings: bool

Presentation: air jumps flap wings (Hollow Knight’s Monarch Wings) instead of a flip. Read by the hero’s animation driver, not by the movement.

§dive_windup: f32

Seconds hanging in the air before a dive plunges.

§dive_speed: f32

Speed of a dive.

§dive_land_time: f32

How long a dive’s impact takes away control.

§roll_drop: i32

Fall height in units from which a landing while moving becomes a roll.

§roll_speed: f32

Roll speed (the roll keeps any faster speed it lands with).

§roll_time: f32

Length of a roll.

§roll_jump_after: f32

Seconds into a roll before it can be cancelled into a jump.

§hard_land_drop: i32

Fall height in units from which a landing without moving is a hard landing.

§hard_land_time: f32

How long a hard landing takes away control.

§corner_correction: i32

Units the head may be nudged sideways around a ceiling corner.

§lift_boost: f32

How much of the speed of moving ground (or a moving wall held) a jump off it keeps: 1 all of it, 0 none. Kept for Tuning::coyote_time after leaving it.

Trait Implementations§

Source§

impl Clone for Tuning

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Tuning

Source§

impl Debug for Tuning

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Tuning

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Tuning

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Tuning

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more