update to updated movement commands
This commit is contained in:
parent
5df6f74071
commit
8686c81c00
@ -1,6 +1,6 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_inspector_egui::Inspectable;
|
||||
use turtle_lib::builders::Turnable;
|
||||
use turtle_lib::builders::{DirectionalMovement, Turnable};
|
||||
use turtle_lib::turtle_bundle::AnimatedTurtle;
|
||||
use turtle_lib::{get_a_turtle, TurtlePlugin};
|
||||
|
||||
@ -22,10 +22,10 @@ fn main() {
|
||||
fn setup(mut commands: Commands) {
|
||||
let mut turtle = get_a_turtle();
|
||||
turtle.set_speed(1);
|
||||
for x in 0..3 {
|
||||
koch(6, &mut turtle);
|
||||
for _x in 0..3 {
|
||||
koch(4, &mut turtle);
|
||||
let mut left = turtle.create_plan();
|
||||
left.left(120.into());
|
||||
left.right(120);
|
||||
turtle.extend_plan(left);
|
||||
}
|
||||
commands.spawn((turtle, Egon {}));
|
||||
@ -34,20 +34,20 @@ fn setup(mut commands: Commands) {
|
||||
fn koch(depth: u32, turtle: &mut AnimatedTurtle) {
|
||||
if depth == 0 {
|
||||
let mut forward = turtle.create_plan();
|
||||
forward.forward(1.into());
|
||||
forward.forward(10);
|
||||
turtle.extend_plan(forward)
|
||||
} else {
|
||||
koch(depth - 1, turtle);
|
||||
let mut left = turtle.create_plan();
|
||||
left.left(60.into());
|
||||
left.left(60);
|
||||
turtle.extend_plan(left);
|
||||
koch(depth - 1, turtle);
|
||||
let mut right = turtle.create_plan();
|
||||
right.right(120.into());
|
||||
right.right(120);
|
||||
turtle.extend_plan(right);
|
||||
koch(depth - 1, turtle);
|
||||
let mut left = turtle.create_plan();
|
||||
left.left(60.into());
|
||||
left.left(60);
|
||||
turtle.extend_plan(left);
|
||||
koch(depth - 1, turtle);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user