Moving the snake
This commit is contained in:
parent
e623fb6553
commit
e860af1d7a
@ -22,10 +22,17 @@ fn spawn_snake(commands: &mut Commands, materials: Res<Materials>) {
|
|||||||
.with(SnakeHead);
|
.with(SnakeHead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn snake_movement(mut head_positions: Query<(&SnakeHead, &mut Transform)>) {
|
||||||
|
for (_head, mut transform) in head_positions.iter_mut() {
|
||||||
|
transform.translation.y += 2.;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::build()
|
App::build()
|
||||||
.add_startup_system(setup.system())
|
.add_startup_system(setup.system())
|
||||||
.add_startup_stage("game_setup", SystemStage::single(spawn_snake.system()))
|
.add_startup_stage("game_setup", SystemStage::single(spawn_snake.system()))
|
||||||
|
.add_system(snake_movement.system())
|
||||||
.add_plugins(DefaultPlugins)
|
.add_plugins(DefaultPlugins)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user