Проектная работа - WIP
This commit is contained in:
@@ -49,10 +49,15 @@ pub fn head_moving(
|
||||
let _span = trace_span!("head_moving").entered();
|
||||
for (mut transform, mut direction, Velocity(velocity), head, entity) in query.into_iter() {
|
||||
let next_dir = head.0.clone();
|
||||
let dir = direction.clone();
|
||||
let snake_path = &mut snake_path;
|
||||
let switch_direction = move |pos: Position| {
|
||||
snake_path.insert(pos.clone(), next_dir.clone());
|
||||
Some(next_dir)
|
||||
if next_dir != dir {
|
||||
snake_path.insert(pos.clone(), next_dir.clone());
|
||||
Some(next_dir)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
};
|
||||
moving(velocity, &time, &mut direction, &mut transform, entity, &mut commands, switch_direction);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user