flip the direction of y now y increases upwards
This commit is contained in:
parent
1d93c22a73
commit
64bd8ee530
@ -615,7 +615,7 @@ impl TurtlePlan {
|
|||||||
/// Coordinates are in screen space:
|
/// Coordinates are in screen space:
|
||||||
/// - `(0, 0)` is at the center
|
/// - `(0, 0)` is at the center
|
||||||
/// - Positive x goes right
|
/// - Positive x goes right
|
||||||
/// - Positive y goes down
|
/// - Positive y goes up
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
|
|||||||
@ -247,7 +247,8 @@ pub fn execute_command(command: &TurtleCommand, state: &mut Turtle) {
|
|||||||
|
|
||||||
TurtleCommand::Goto(coord) => {
|
TurtleCommand::Goto(coord) => {
|
||||||
let start = state.params.position;
|
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 {
|
if state.params.pen_down {
|
||||||
// Draw line segment with round caps
|
// Draw line segment with round caps
|
||||||
|
|||||||
@ -400,7 +400,8 @@ impl TweenController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
TurtleCommand::Goto(coord) => {
|
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) => {
|
TurtleCommand::SetHeading(heading) => {
|
||||||
target.heading = normalize_angle(*heading);
|
target.heading = normalize_angle(*heading);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user