Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
tsukinoko-kun committed Jul 7, 2024
1 parent 7328034 commit 4a59a88
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/enemy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,8 @@ fn spawn_enemy(
Enemy,
SpriteBundle {
texture,
transform: Transform::from_scale(Vec3::splat(2.0)).with_translation(Vec3::new(
0.0,
0.0,
0.0,
)),
transform: Transform::from_scale(Vec3::splat(2.0))
.with_translation(Vec3::new(0.0, 0.0, 0.0)),
..default()
},
TextureAtlas {
Expand Down
5 changes: 4 additions & 1 deletion src/movement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ impl Velocity {
}

pub fn from_vec2(direction: Vec2, speed: f32) -> Self {
Self { direction: Vec3::new(direction.x, direction.y, 0.0), speed }
Self {
direction: Vec3::new(direction.x, direction.y, 0.0),
speed,
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ fn player_projectile(
.and_then(|cursor| camera.viewport_to_world_2d(camera_transform, cursor))
{
let direction = (world_position - transform.translation().xy()).normalize();
commands.spawn(ProjectileBundle::new(asset_server, texture_atlas_layouts, transform.translation(), direction));
commands.spawn(ProjectileBundle::new(
asset_server,
texture_atlas_layouts,
transform.translation(),
direction,
));
return;
}
}
Expand Down

0 comments on commit 4a59a88

Please sign in to comment.