Autoformat
This commit is contained in:
76
src/lib.rs
76
src/lib.rs
@@ -111,22 +111,24 @@ 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
|
||||||
Ship,
|
.spawn((
|
||||||
Position(Vec2::default()),
|
Ship,
|
||||||
Velocity(Vec2::ZERO),
|
Position(Vec2::default()),
|
||||||
Rotation(0.0),
|
Velocity(Vec2::ZERO),
|
||||||
Mesh2d(ship_mesh),
|
Rotation(0.0),
|
||||||
MeshMaterial2d(ship_material),
|
Mesh2d(ship_mesh),
|
||||||
ThrusterColors(thruster_firing_id, thruster_stopped_id),
|
MeshMaterial2d(ship_material),
|
||||||
Transform::default().with_scale(Vec3::new(20.0, 20.0, 20.0)),
|
ThrusterColors(thruster_firing_id, thruster_stopped_id),
|
||||||
)).with_child((
|
Transform::default().with_scale(Vec3::new(20.0, 20.0, 20.0)),
|
||||||
Mesh2d(thruster_mesh),
|
))
|
||||||
MeshMaterial2d(thruster_material),
|
.with_child((
|
||||||
Transform::default()
|
Mesh2d(thruster_mesh),
|
||||||
.with_scale(Vec3::splat(0.5))
|
MeshMaterial2d(thruster_material),
|
||||||
.with_translation(Vec3::new(-0.5, 0.0, -0.1)),
|
Transform::default()
|
||||||
));
|
.with_scale(Vec3::splat(0.5))
|
||||||
|
.with_translation(Vec3::new(-0.5, 0.0, -0.1)),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -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,20 +234,22 @@ 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
|
||||||
TitleUI,
|
.spawn((
|
||||||
Node {
|
TitleUI,
|
||||||
flex_direction: FlexDirection::Column,
|
Node {
|
||||||
..Default::default()
|
flex_direction: FlexDirection::Column,
|
||||||
},
|
..Default::default()
|
||||||
)).with_children(|cmds| {
|
},
|
||||||
cmds.spawn((
|
))
|
||||||
Text::new("Robert's Bad Asteroids Game"),
|
.with_children(|cmds| {
|
||||||
TextFont::from_font_size(50.0),
|
cmds.spawn((
|
||||||
));
|
Text::new("Robert's Bad Asteroids Game"),
|
||||||
cmds.spawn((
|
TextFont::from_font_size(50.0),
|
||||||
Text::new("Press space to begin"),
|
));
|
||||||
TextFont::from_font_size(40.0),
|
cmds.spawn((
|
||||||
));
|
Text::new("Press space to begin"),
|
||||||
});
|
TextFont::from_font_size(40.0),
|
||||||
|
));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user