zuma-like/src/states/linear/systems_track.rs

45 lines
1.6 KiB
Rust
Raw Normal View History

2026-04-15 23:02:14 +03:00
use crate::states::linear::*;
use crate::{FACTOR, HEIGHT, WIDTH};
use bevy::prelude::*;
pub const CENTER_X: f32 = 0.0;
pub const CENTER_Y: f32 = 0.0;
// pub const FACTOR_RADIUS: f32 = FACTOR as f32 / 2.0;
pub const STEP: f32 = FACTOR as f32 / SCALE;
pub const SCALE: f32 = 2.0;
pub fn setup_linear_track(mut commands: Commands) {
println!("Построение трека начато");
commands.spawn((
Track {
start_point: Vec2 {
x: CENTER_X - FACTOR as f32 * 7.0,
y: CENTER_Y - FACTOR as f32 * 4.0,
},
start_direction: Vec2::X,
segments: vec![
PathSegment::Line { length: STEP * 2.0 },
PathSegment::Turn { radius: STEP, left: true },
PathSegment::Line { length: STEP },
PathSegment::Turn { radius: STEP, left: false },
PathSegment::Line { length: STEP * 10.0 },
PathSegment::Turn { radius: STEP, left: true },
PathSegment::Line { length: STEP * 4.0 },
PathSegment::Turn { radius: STEP, left: true },
PathSegment::Turn { radius: STEP, left: false },
PathSegment::Line { length: STEP * 2.0 },
PathSegment::Turn { radius: STEP, left: true },
PathSegment::Line { length: STEP * 6.0 },
PathSegment::Turn { radius: STEP, left: true },
PathSegment::Line { length: STEP * 1.0 },
PathSegment::Turn { radius: STEP, left: true },
],
},
LinearStateMarker,
));
}