Skip to content

Commit 3dbfc1c

Browse files
committed
fix: Zoom camera only when in debug mode
1 parent 941434c commit 3dbfc1c

File tree

7 files changed

+38
-7
lines changed

7 files changed

+38
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "magus-parvus"
3-
version = "0.1.2"
3+
version = "0.1.3"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2023 PraxTube
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Magus Parvus
2+
3+
A cozy little 2D top down mage game. You cast spells by typing their name.
4+
5+
## Appendix
6+
7+
[Credits](https://github.com/PraxTube/magus-parvus/blob/master/CREDITS.md).
8+
[License](https://github.com/PraxTube/magus-parvus/blob/master/LICENSE),
9+
applies to everything that doesn't already have a license.

src/enemy/demon_boss/strike.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ use super::{DemonBoss, DemonBossState};
88
const STRIKE_HITBOX_START: f32 = 1.2;
99
const STRIKE_HITBOX_TIME: f32 = 0.2;
1010

11-
#[derive(Component)]
12-
#[derive(Default)]
11+
#[derive(Component, Default)]
1312
pub struct DemonBossStrike {
1413
pub striked: bool,
1514
pub spawned_explosions: bool,
@@ -20,8 +19,6 @@ pub struct StrikeCooldown {
2019
timer: Timer,
2120
}
2221

23-
24-
2522
fn spawn_strike_cooldown(
2623
mut commands: Commands,
2724
q_demon_boss: Query<&DemonBoss>,

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn main() {
4747
.set(ImagePlugin::default_nearest())
4848
.build(),
4949
RapierPhysicsPlugin::<NoUserData>::default(),
50-
RapierDebugRenderPlugin::default(),
50+
// RapierDebugRenderPlugin::default(),
5151
Animation2DPlugin,
5252
))
5353
.insert_resource(Msaa::Off)

src/world/camera.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use bevy_rapier2d::dynamics::Velocity;
77
use super::camera_shake::{update_camera, CameraShake};
88
use crate::player::input::PlayerInput;
99
use crate::player::{Player, PlayerState};
10+
use crate::spell::debug_spell::DebugSpell;
1011
use crate::GameState;
1112

1213
// How much `1.0` in bevy coordinates translates to the pixels of a sprite.
@@ -50,9 +51,14 @@ fn update_camera_target(
5051
}
5152

5253
fn zoom_camera(
54+
debug_spell: Res<DebugSpell>,
5355
mut q_projection: Query<&mut OrthographicProjection, With<MainCamera>>,
5456
player_input: Res<PlayerInput>,
5557
) {
58+
if !debug_spell.active {
59+
return;
60+
}
61+
5662
let mut projection = match q_projection.get_single_mut() {
5763
Ok(p) => p,
5864
Err(_) => return,

0 commit comments

Comments
 (0)