add F2 key to toggle shadows

This commit is contained in:
yuni 2024-04-24 20:40:20 +02:00
parent 6d8341ba56
commit e3de0d56f7
3 changed files with 11 additions and 0 deletions

View file

@ -50,6 +50,7 @@ This game aims to respect the player as much as possible. It doesn't waste your
- M: Toggle map
- F: Toggle 3rd person view
- Y: Toggle rotation stabilizer
- F2: Toggle shadows
- F3: Toggle sound effects
- F4: Toggle music
- F7: Restart game
@ -176,6 +177,7 @@ python -m http.server -d wasm
- git:
- Implement animations
- Implement shadows
- Implement markers for points of interest in the map
- Add new secret character
- v0.7.3: Implement map. You can now zoom out ALL THE WAY

View file

@ -274,6 +274,7 @@ pub fn update_fov(
pub fn handle_input(
keyboard_input: Res<ButtonInput<KeyCode>>,
mut q_light: Query<&mut DirectionalLight>,
mut settings: ResMut<var::Settings>,
mut mapcam: ResMut<MapCam>,
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
@ -282,6 +283,12 @@ pub fn handle_input(
if keyboard_input.just_pressed(settings.key_camera) {
settings.third_person ^= true;
}
if keyboard_input.just_pressed(settings.key_shadows) {
settings.shadows_sun ^= true;
for mut light in &mut q_light {
light.shadows_enabled = settings.shadows_sun;
}
}
if keyboard_input.just_pressed(settings.key_map) {
settings.map_active ^= true;
*mapcam = MapCam::default();

View file

@ -84,6 +84,7 @@ pub struct Settings {
pub key_interact: KeyCode,
pub key_vehicle: KeyCode,
pub key_camera: KeyCode,
pub key_shadows: KeyCode,
pub key_rotate: KeyCode,
pub key_rotation_stabilizer: KeyCode,
pub key_mouseup: KeyCode,
@ -197,6 +198,7 @@ impl Default for Settings {
key_interact: KeyCode::KeyE,
key_vehicle: KeyCode::KeyQ,
key_camera: KeyCode::KeyF,
key_shadows: KeyCode::F2,
key_rotate: KeyCode::KeyR,
key_rotation_stabilizer: KeyCode::KeyY,
key_mouseup: KeyCode::KeyI,