From 64bd8ee5306abf8f4b636ba92d00a6c1c8a02a66 Mon Sep 17 00:00:00 2001 From: Franz Dietrich Date: Sun, 19 Oct 2025 14:19:00 +0200 Subject: [PATCH] flip the direction of y now y increases upwards --- turtle-lib/src/builders.rs | 2 +- turtle-lib/src/execution.rs | 3 ++- turtle-lib/src/tweening.rs | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/turtle-lib/src/builders.rs b/turtle-lib/src/builders.rs index 9fb48c2..bdcf84e 100644 --- a/turtle-lib/src/builders.rs +++ b/turtle-lib/src/builders.rs @@ -615,7 +615,7 @@ impl TurtlePlan { /// Coordinates are in screen space: /// - `(0, 0)` is at the center /// - Positive x goes right - /// - Positive y goes down + /// - Positive y goes up /// /// # Examples /// diff --git a/turtle-lib/src/execution.rs b/turtle-lib/src/execution.rs index 3b068c8..6eab70f 100644 --- a/turtle-lib/src/execution.rs +++ b/turtle-lib/src/execution.rs @@ -247,7 +247,8 @@ pub fn execute_command(command: &TurtleCommand, state: &mut Turtle) { TurtleCommand::Goto(coord) => { let start = state.params.position; - state.params.position = *coord; + // Flip Y coordinate: turtle graphics uses Y+ = up, but Macroquad uses Y+ = down + state.params.position = vec2(coord.x, -coord.y); if state.params.pen_down { // Draw line segment with round caps diff --git a/turtle-lib/src/tweening.rs b/turtle-lib/src/tweening.rs index 4896735..e39396f 100644 --- a/turtle-lib/src/tweening.rs +++ b/turtle-lib/src/tweening.rs @@ -400,7 +400,8 @@ impl TweenController { }); } TurtleCommand::Goto(coord) => { - target.position = *coord; + // Flip Y coordinate: turtle graphics uses Y+ = up, but Macroquad uses Y+ = down + target.position = vec2(coord.x, -coord.y); } TurtleCommand::SetHeading(heading) => { target.heading = normalize_angle(*heading);