Skip to content

Commit

Permalink
Lock movement rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
mattzque committed Mar 19, 2024
1 parent e219f1c commit e758ca2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_iconwars"
version = "0.1.3"
version = "0.1.4"
edition = "2021"
license = "MIT OR Apache-2.0"

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ can be adjusted in real-time, but it may crash the game.

## TODO

* [ ] fix controls (up should always be up from the camera point of view)
* [X] fix controls (up should always be up from the camera point of view)
* [ ] change sound effect spamming (n projectiles playing 1 effect instead of n)
* [ ] escape on web also closes fullscreen, add other key for pause screen
* [ ] make captured hud less obstructive (make smaller and add more transparency)
Expand All @@ -39,6 +39,7 @@ can be adjusted in real-time, but it may crash the game.

## Changelog

* `v0.1.4` update bevy version and lock movement rotation
* `v0.1.3` (**this version was the Bevy Jam entry**) removed some verbose debug logging; fixed player allowed to shoot in dropzone
* `v0.1.2` fixed a bug where the game crashed when all music tracks were played
* `v0.1.1` initial release
Expand Down
2 changes: 2 additions & 0 deletions src/game/camera.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::f32::consts::PI;

use bevy::input::mouse::MouseWheel;
use bevy::prelude::*;
use bevy::render::view::RenderLayers;
Expand Down
9 changes: 5 additions & 4 deletions src/game/icons/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ fn update_player_rotation(

fn update_key_input(
time: Res<Time>,
mut query: Query<(Entity, &mut IconTransform, &mut IconVelocity), With<IconPlayerController>>,
mut query: Query<(Entity, &IconTransform, &mut IconVelocity), With<IconPlayerController>>,
keys: Res<ButtonInput<KeyCode>>,
settings: Res<SettingsResource>,
) {
let dt = time.delta_seconds();
// info!("print dt = {:?}", dt);
if let Ok((_entity, transform, mut velocity_)) = query.get_single_mut() {
// let turn = if keys.any_pressed([KeyCode::Left, KeyCode::A]) {
// let turn = if keys.any_pressed([KeyCode::KeyQ]) {
// // turn left
// Some(1.0)
// } else if keys.any_pressed([KeyCode::Right, KeyCode::D]) {
// } else if keys.any_pressed([KeyCode::KeyE]) {
// // turn right
// Some(-1.0)
// } else {
Expand All @@ -75,7 +75,8 @@ fn update_key_input(
// transform.rotation = normalize_angle(transform.rotation);
// }

let rotation = transform.rotation;
// let rotation = transform.rotation;
let rotation = 0.0; // transform.rotation;

let r = std::f32::consts::PI / 2.0;
let forward_vector = Vec2::new((rotation - r).cos(), (rotation - r).sin());
Expand Down
2 changes: 1 addition & 1 deletion src/game/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl Default for SettingsResource {
seek_max_speed: 0.78,
seek_max_force: 0.08,

controller_turn_speed: 3.85,
controller_turn_speed: 1.85,
controller_acceleration: 35.0,
controller_dampening: 210.0,
controller_max_speed: 100.0,
Expand Down

0 comments on commit e758ca2

Please sign in to comment.