summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorTom Barrett <tom@tombarrett.xyz>2024-01-14 13:14:06 +0100
committerTom Barrett <tom@tombarrett.xyz>2024-01-14 13:14:06 +0100
commit7ad283fd40e093511a84f9f1cdd67689acde444b (patch)
tree2389e482cd8062509dfe7bdfd12a50797fa20ade /src/main.rs
parent15fe765d380abc70ed371a2af2806dbb2fa95199 (diff)
bevy 11
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/main.rs b/src/main.rs
index b06e30c..136bb87 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -177,7 +177,8 @@ fn cosmonaut_detect(
cursor_position.x -=
(constants::WINDOW_WIDTH / 2.0) - constants::TILE_SIZE * constants::TILE_SCALE * 0.5;
cursor_position.y -=
- (constants::WINDOW_HEIGHT / 2.0) - constants::TILE_SIZE * constants::TILE_SCALE * 0.5;
+ (constants::WINDOW_HEIGHT / 2.0) + constants::TILE_SIZE * constants::TILE_SCALE * 0.5;
+ cursor_position.y *= -1.0;
for (transform, sprite, texture_atlas_handle) in q.iter_mut() {
if transform.translation.x < cursor_position.x
&& transform.translation.x + constants::TILE_SIZE * constants::TILE_SCALE
@@ -210,7 +211,8 @@ fn mouse(
cursor_position.x -=
(constants::WINDOW_WIDTH / 2.0) - constants::TILE_SIZE * constants::TILE_SCALE * 0.5;
cursor_position.y -=
- (constants::WINDOW_HEIGHT / 2.0) - constants::TILE_SIZE * constants::TILE_SCALE * 0.5;
+ (constants::WINDOW_HEIGHT / 2.0) + constants::TILE_SIZE * constants::TILE_SCALE * 0.5;
+ cursor_position.y *= -1.0;
for (cell, _, mut sprite) in q.iter_mut() {
if cell.selected {
@@ -290,16 +292,19 @@ pub fn main() {
..default()
}),
)
- .add_startup_system(setup)
- .add_systems((
- cell::insert,
- cell::falling,
- cell::check,
- cell::start_explosion,
- mouse,
- cosmonaut_detect,
- animation,
- star_spawning,
- ))
+ .add_systems(Startup, setup)
+ .add_systems(
+ Update,
+ (
+ cell::insert,
+ cell::falling,
+ cell::check,
+ cell::start_explosion,
+ mouse,
+ cosmonaut_detect,
+ animation,
+ star_spawning,
+ ),
+ )
.run();
}