From 6900d1ce313f901b749427e2087422631b3bee2d Mon Sep 17 00:00:00 2001 From: Astro Date: Sun, 16 Jan 2022 00:10:11 +0100 Subject: [PATCH] shoot eggs --- src/input.rs | 8 ++++++-- src/main.rs | 1 + src/map.rs | 12 ++++++++++-- src/player.rs | 52 +++++++++++++++++++++++++++++++++++++++++++++------ 4 files changed, 63 insertions(+), 10 deletions(-) diff --git a/src/input.rs b/src/input.rs index 88741b3..836194a 100644 --- a/src/input.rs +++ b/src/input.rs @@ -18,6 +18,7 @@ pub enum Key { Left, Right, Jump, + Shoot, } const KEYBOARD_KEYS: &[(KeyCode, Source, Key)] = &[ @@ -25,12 +26,14 @@ const KEYBOARD_KEYS: &[(KeyCode, Source, Key)] = &[ (KeyCode::Down, Source::KeyboardRight, Key::Down), (KeyCode::Left, Source::KeyboardRight, Key::Left), (KeyCode::Right, Source::KeyboardRight, Key::Right), - (KeyCode::Return, Source::KeyboardRight, Key::Jump), + (KeyCode::RShift, Source::KeyboardRight, Key::Jump), + (KeyCode::RControl, Source::KeyboardRight, Key::Shoot), (KeyCode::W, Source::KeyboardLeft, Key::Up), (KeyCode::S, Source::KeyboardLeft, Key::Down), (KeyCode::A, Source::KeyboardLeft, Key::Left), (KeyCode::D, Source::KeyboardLeft, Key::Right), - (KeyCode::Space, Source::KeyboardLeft, Key::Jump), + (KeyCode::LShift, Source::KeyboardLeft, Key::Jump), + (KeyCode::LControl, Source::KeyboardLeft, Key::Shoot), ]; const GAMEPAD_KEYS: &[(GamepadButtonType, Key)] = &[ @@ -39,6 +42,7 @@ const GAMEPAD_KEYS: &[(GamepadButtonType, Key)] = &[ (GamepadButtonType::DPadLeft, Key::Left), (GamepadButtonType::DPadRight, Key::Right), (GamepadButtonType::South, Key::Jump), + (GamepadButtonType::East, Key::Shoot), ]; #[derive(Default)] diff --git a/src/main.rs b/src/main.rs index 5af82fe..f569686 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,7 @@ mod off_map; pub enum Layer { Map, Player, + Projectile, } fn main() { diff --git a/src/map.rs b/src/map.rs index fe9ec1c..12aab91 100644 --- a/src/map.rs +++ b/src/map.rs @@ -13,6 +13,8 @@ pub struct LevelResources { soil_material: Handle, grass_material: Handle, bridge_material: Handle, + pub egg_material: Handle, + pub egg_mesh: Handle, last_build: Option