server side attack. TODO: fix origin on shooter
This commit is contained in:
@@ -36,7 +36,7 @@ pub struct Jumper {
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Component)]
|
||||
pub enum PlayerCommand {
|
||||
BasicAttack { fired_at: Vec2 },
|
||||
BasicAttack { origin: Vec2, direction: Vec2 },
|
||||
}
|
||||
|
||||
pub enum ClientChannel {
|
||||
@@ -60,7 +60,7 @@ pub enum ServerMessages {
|
||||
},
|
||||
SpawnProjectile {
|
||||
entity: Entity,
|
||||
position: Vec2,
|
||||
origin: Vec2,
|
||||
direction: Vec2,
|
||||
},
|
||||
DespawnProjectile {
|
||||
@@ -152,7 +152,7 @@ pub fn setup_level(mut _commands: Commands) {
|
||||
info!("bygger level...");
|
||||
}
|
||||
|
||||
pub fn spawn_projectile(commands: &mut Commands, location: Vec2, direction: Vec2) -> Entity {
|
||||
pub fn spawn_projectile(commands: &mut Commands, origin: Vec2, direction: Vec2) -> Entity {
|
||||
commands
|
||||
.spawn()
|
||||
.insert(Collider::ball(0.1))
|
||||
@@ -160,7 +160,7 @@ pub fn spawn_projectile(commands: &mut Commands, location: Vec2, direction: Vec2
|
||||
.insert(ActiveEvents::COLLISION_EVENTS)
|
||||
.insert(Projectile {
|
||||
duration: Timer::from_seconds(1.5, false),
|
||||
location,
|
||||
origin,
|
||||
direction,
|
||||
})
|
||||
.id()
|
||||
@@ -169,6 +169,6 @@ pub fn spawn_projectile(commands: &mut Commands, location: Vec2, direction: Vec2
|
||||
#[derive(Debug, Component)]
|
||||
pub struct Projectile {
|
||||
pub duration: Timer,
|
||||
pub location: Vec2,
|
||||
pub origin: Vec2,
|
||||
pub direction: Vec2,
|
||||
}
|
||||
|
Reference in New Issue
Block a user