BANG BIG PEANITS

This commit is contained in:
2026-07-25 16:50:55 +03:00
commit a2b00e5942
11 changed files with 592 additions and 0 deletions

54
src/player.rs Normal file
View File

@@ -0,0 +1,54 @@
use super::controls::InputState;
use raylib::prelude::*;
#[derive(Default)]
pub struct Player {
pub position: Vector2,
width: f32,
height: f32,
speed: f32,
jump_velocity: f32,
grounded: bool,
}
impl Player {
fn new(
position: Vector2,
width: f32,
height: f32,
speed: f32,
jump_velocity: f32,
grounded: bool,
) -> Self {
Self {
position,
width,
height,
speed,
jump_velocity,
grounded,
}
}
pub fn handle_input(&mut self, input: &InputState) {
// Da inpoot handol))
if input.right {
self.position.x += 2.0;
} else if input.left {
self.position.x -= 2.0;
} else if input.down {
self.position.y += 4.0;
}
}
pub fn handle_jump(&mut self, input: &InputState) {
if input.jump {
self.position.y -= 10.0;
}
}
pub fn rect(&self) -> Rectangle {
todo!()
// Collision bawx n shi
}
}