From 60a2af50e22ef9f0c53ccc06b434db7c3bfe20ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Ramiro=20D=C3=ADaz?= Date: Fri, 29 Dec 2023 20:03:29 -0300 Subject: [PATCH] fix: remove patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Agustín Ramiro Díaz --- src/main.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index b400b5b..c45c731 100644 --- a/src/main.rs +++ b/src/main.rs @@ -102,9 +102,10 @@ impl Plugin for SnakePlugin { Update, ( toroid_coordinates, - update_local_coordinates_to_world_transforms, - apply_deferred, add_sprite_bundles, + // This is needed in order to render the sprites correctly, we need to flush the sprites into the world and then update their transforms + apply_deferred, + update_local_coordinates_to_world_transforms, ) .chain() .in_set(InGameSet::Last) @@ -270,12 +271,6 @@ fn add_sprite_bundles( ..Default::default() }, - // TODO: find another way of hiding this - // The problem is that the SpriteBundle is added with a Transform, and just in the next frame it's updated to its corresponding Coordinate. So we've got a frame where the sprite is in the wrong place (middle of the screen) - // This is a quick patch to spawn the sprite in a place where it's not visible - transform: Transform::from_translation( - Vec3::ONE * BOARD_VIEWPORT_IN_WORLD_UNITS * 100.0, - ), ..Default::default() }); }