diff --git a/assets/world.txt b/assets/world.txt index 9c290be..2e51633 100644 --- a/assets/world.txt +++ b/assets/world.txt @@ -8,7 +8,7 @@ info section world section TT -TTT _______ P ______ ___ +TTT P _______ ______ ___ TTTTTTTTTEEEGGGGGGGETEGGGGGGEGGGE TTTTTTTTTTEEEEEEEEEEEEEEEEEEEEEEE TTTTTTTEEEEEEEEEEEEEEEEEEEEEEEEEE diff --git a/src/game/player.rs b/src/game/player.rs index b3adb59..417b15c 100644 --- a/src/game/player.rs +++ b/src/game/player.rs @@ -12,7 +12,17 @@ use super::{scene::PlayerCoords, set::IngameSet}; mod animation; #[derive(Component)] -struct Player; +struct Player { + move_cooldown: Timer, +} + +impl Default for Player { + fn default() -> Self { + Self { + move_cooldown: Timer::from_seconds(0.01, TimerMode::Repeating), + } + } +} #[derive(Resource)] pub struct PlayerSpawnOneshot(pub SystemId); @@ -24,7 +34,8 @@ impl FromWorld for PlayerSpawnOneshot { } pub(super) fn player_plugin(app: &mut App) { - app.init_resource::(); + app.add_systems(Update, (move_player, debug_player_pos)) + .init_resource::(); } #[derive(Component, Hash, PartialEq, Eq, Default)] @@ -34,10 +45,39 @@ enum PlayerAnimations { Walk, } -// fn move_player( -// kb_input: Res>, -// mut query: -// ) +fn debug_player_pos(query: Query<&Transform, With>) { + let trans = query.single(); + dbg!(trans); +} +fn move_player( + kb_input: Res>, + mut query: Query<( + &mut Velocity, + &mut Player, + &mut KinematicCharacterController, + )>, + time: Res