linear track plugin
This commit is contained in:
parent
c1e53bdab0
commit
68c895ec14
6 changed files with 160 additions and 0 deletions
44
src/states/linear/systems_track.rs
Normal file
44
src/states/linear/systems_track.rs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
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,
|
||||
));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue