|
|
|
@ -143,20 +143,21 @@ fn init_bird(
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
let material = MeshMaterial2d(materials.add(ColorMaterial {
|
|
|
|
let material = MeshMaterial2d(materials.add(ColorMaterial {
|
|
|
|
texture: Some(server.load("flappy/bird.png")),
|
|
|
|
texture: Some(server.load("flappy/bird.png")),
|
|
|
|
color: ORANGE.into(),
|
|
|
|
// color: ORANGE.into(),
|
|
|
|
|
|
|
|
color: BLACK.into(),
|
|
|
|
alpha_mode: AlphaMode2d::Blend,
|
|
|
|
alpha_mode: AlphaMode2d::Blend,
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
let mesh = Mesh2d(meshes.add(Rectangle::new(1.0, 1.0)));
|
|
|
|
let mesh = Mesh2d(meshes.add(Rectangle::new(1.0, 1.2)));
|
|
|
|
|
|
|
|
|
|
|
|
let name = Name::new("bird");
|
|
|
|
let name = Name::new("bird");
|
|
|
|
|
|
|
|
|
|
|
|
let t = Transform::from_xyz(0.0, 0.0, 0.0).with_scale(Vec3::splat(100.0));
|
|
|
|
let t = Transform::from_xyz(0.0, 0.0, 0.0).with_scale(Vec3::splat(50.0));
|
|
|
|
|
|
|
|
|
|
|
|
let physics = (
|
|
|
|
let physics = (
|
|
|
|
RigidBody::Static,
|
|
|
|
RigidBody::Static,
|
|
|
|
Collider::circle(0.5),
|
|
|
|
Collider::rectangle(1.0, 1.2),
|
|
|
|
Mass(10.0),
|
|
|
|
Mass(10.0),
|
|
|
|
ExternalImpulse::default().with_persistence(false),
|
|
|
|
ExternalImpulse::default().with_persistence(false),
|
|
|
|
MaxLinearSpeed(500.0),
|
|
|
|
MaxLinearSpeed(500.0),
|
|
|
|
@ -450,8 +451,7 @@ fn init_ui(mut commands: Commands) {
|
|
|
|
))
|
|
|
|
))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent.spawn((Node {
|
|
|
|
parent.spawn((Node {
|
|
|
|
align_self: AlignSelf::End,
|
|
|
|
align_self: AlignSelf::Center,
|
|
|
|
justify_self: JustifySelf::End,
|
|
|
|
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
}, Button, children![Text::new("Close")]));
|
|
|
|
}, Button, children![Text::new("Close")]));
|
|
|
|
}).observe(hide_credits);
|
|
|
|
}).observe(hide_credits);
|
|
|
|
@ -836,7 +836,8 @@ fn debug_collision_end_observations(
|
|
|
|
/// When the player moves forward while alive
|
|
|
|
/// When the player moves forward while alive
|
|
|
|
/// spawn more batches and despawn old batches
|
|
|
|
/// spawn more batches and despawn old batches
|
|
|
|
fn manage_batches(
|
|
|
|
fn manage_batches(
|
|
|
|
trigger: Trigger<OnCollisionStart>,
|
|
|
|
// TODO: Trigger on both start and end??
|
|
|
|
|
|
|
|
trigger: Trigger<OnCollisionEnd>,
|
|
|
|
state: Res<State<PlayerState>>,
|
|
|
|
state: Res<State<PlayerState>>,
|
|
|
|
bird: Query<Entity, With<Bird>>,
|
|
|
|
bird: Query<Entity, With<Bird>>,
|
|
|
|
batches: Query<(Entity, &Batch)>,
|
|
|
|
batches: Query<(Entity, &Batch)>,
|
|
|
|
|