From 7ad283fd40e093511a84f9f1cdd67689acde444b Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Sun, 14 Jan 2024 13:14:06 +0100 Subject: bevy 11 --- src/main.rs | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'src/main.rs') 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(); } -- cgit v1.2.3