feat: stone cannon sprite and rework
This commit is contained in:
parent
d2c5e0944c
commit
65d2d997b1
|
@ -75,14 +75,17 @@ pub fn attack(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
asset_server: Res<AssetServer>,
|
asset_server: Res<AssetServer>,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
for player_transform in set.p1().iter_mut() {
|
for player_transform in set.p1().iter_mut() {
|
||||||
|
let attack_position = player_transform.translation + ((player_transform.rotation * Vec3::Y) * 50.);
|
||||||
|
|
||||||
if keys.just_pressed(KeyCode::Enter) {
|
if keys.just_pressed(KeyCode::Enter) {
|
||||||
commands
|
commands
|
||||||
.spawn(SpriteBundle {
|
.spawn(SpriteBundle {
|
||||||
texture: asset_server.load("player/player-4x.png"),
|
texture: asset_server.load("attacks/stone_cannon.png"),
|
||||||
transform: Transform {
|
transform: Transform {
|
||||||
scale: Vec3::splat(0.1),
|
scale: Vec3::splat(0.2),
|
||||||
translation: player_transform.translation,
|
translation: attack_position,
|
||||||
rotation: player_transform.rotation,
|
rotation: player_transform.rotation,
|
||||||
},
|
},
|
||||||
..default()
|
..default()
|
||||||
|
@ -96,7 +99,7 @@ pub fn attack(
|
||||||
|
|
||||||
for mut attack_transform in set.p0().iter_mut() {
|
for mut attack_transform in set.p0().iter_mut() {
|
||||||
let direction = attack_transform.rotation * Vec3::Y;
|
let direction = attack_transform.rotation * Vec3::Y;
|
||||||
attack_transform.translation += direction * 10.;
|
attack_transform.translation += direction * 20.;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue