From 37f9f1c6feda676be30bef31291eaed2a5fc82ce Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 2 Oct 2022 14:52:48 -0500 Subject: add jumping --- azalea-block/src/behavior.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'azalea-block/src') diff --git a/azalea-block/src/behavior.rs b/azalea-block/src/behavior.rs index db357632..18854fff 100644 --- a/azalea-block/src/behavior.rs +++ b/azalea-block/src/behavior.rs @@ -1,7 +1,17 @@ -#[derive(Default)] pub struct BlockBehavior { pub has_collision: bool, pub friction: f32, + pub jump_factor: f32, +} + +impl Default for BlockBehavior { + fn default() -> Self { + Self { + has_collision: true, + friction: 0.6, + jump_factor: 1.0, + } + } } impl BlockBehavior { @@ -16,4 +26,10 @@ impl BlockBehavior { self.friction = friction; self } + + #[inline] + pub fn jump_factor(mut self, jump_factor: f32) -> Self { + self.jump_factor = jump_factor; + self + } } -- cgit v1.2.3