Autoformat
This commit is contained in:
20
src/lib.rs
20
src/lib.rs
@@ -111,7 +111,8 @@ fn spawn_player(
|
|||||||
let thruster_material = materials.add(PLAYER_SHIP_COLOR);
|
let thruster_material = materials.add(PLAYER_SHIP_COLOR);
|
||||||
let thruster_mesh = meshes.add(triangle);
|
let thruster_mesh = meshes.add(triangle);
|
||||||
|
|
||||||
commands.spawn((
|
commands
|
||||||
|
.spawn((
|
||||||
Ship,
|
Ship,
|
||||||
Position(Vec2::default()),
|
Position(Vec2::default()),
|
||||||
Velocity(Vec2::ZERO),
|
Velocity(Vec2::ZERO),
|
||||||
@@ -120,7 +121,8 @@ fn spawn_player(
|
|||||||
MeshMaterial2d(ship_material),
|
MeshMaterial2d(ship_material),
|
||||||
ThrusterColors(thruster_firing_id, thruster_stopped_id),
|
ThrusterColors(thruster_firing_id, thruster_stopped_id),
|
||||||
Transform::default().with_scale(Vec3::new(20.0, 20.0, 20.0)),
|
Transform::default().with_scale(Vec3::new(20.0, 20.0, 20.0)),
|
||||||
)).with_child((
|
))
|
||||||
|
.with_child((
|
||||||
Mesh2d(thruster_mesh),
|
Mesh2d(thruster_mesh),
|
||||||
MeshMaterial2d(thruster_material),
|
MeshMaterial2d(thruster_material),
|
||||||
Transform::default()
|
Transform::default()
|
||||||
@@ -148,9 +150,13 @@ fn input_ship_thruster(
|
|||||||
|
|
||||||
if keyboard_input.pressed(KeyCode::KeyW) {
|
if keyboard_input.pressed(KeyCode::KeyW) {
|
||||||
velocity.0 += Vec2::from_angle(rotation.0) * SHIP_THRUST;
|
velocity.0 += Vec2::from_angle(rotation.0) * SHIP_THRUST;
|
||||||
commands.entity(*thrusters).insert(MeshMaterial2d(colors.0.clone()));
|
commands
|
||||||
|
.entity(*thrusters)
|
||||||
|
.insert(MeshMaterial2d(colors.0.clone()));
|
||||||
} else {
|
} else {
|
||||||
commands.entity(*thrusters).insert(MeshMaterial2d(colors.1.clone()));
|
commands
|
||||||
|
.entity(*thrusters)
|
||||||
|
.insert(MeshMaterial2d(colors.1.clone()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,13 +234,15 @@ fn spawn_ui(mut commands: Commands, score: Res<Score>, lives: Res<Lives>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn start_screen(mut commands: Commands) {
|
fn start_screen(mut commands: Commands) {
|
||||||
commands.spawn((
|
commands
|
||||||
|
.spawn((
|
||||||
TitleUI,
|
TitleUI,
|
||||||
Node {
|
Node {
|
||||||
flex_direction: FlexDirection::Column,
|
flex_direction: FlexDirection::Column,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
)).with_children(|cmds| {
|
))
|
||||||
|
.with_children(|cmds| {
|
||||||
cmds.spawn((
|
cmds.spawn((
|
||||||
Text::new("Robert's Bad Asteroids Game"),
|
Text::new("Robert's Bad Asteroids Game"),
|
||||||
TextFont::from_font_size(50.0),
|
TextFont::from_font_size(50.0),
|
||||||
|
|||||||
Reference in New Issue
Block a user