Added gun sprite
This commit is contained in:
parent
d30dc8dcd5
commit
f1529d7e58
7 changed files with 225 additions and 32 deletions
|
|
@ -30,6 +30,9 @@ pub struct Player {
|
|||
#[reflect(hidden)]
|
||||
move_right: bool,
|
||||
|
||||
#[reflect(hidden)]
|
||||
reset_position: bool,
|
||||
|
||||
#[reflect(hidden)]
|
||||
yaw: f32,
|
||||
|
||||
|
|
@ -85,6 +88,9 @@ impl ScriptTrait for Player {
|
|||
KeyCode::KeyD => {
|
||||
self.move_right = is_pressed;
|
||||
},
|
||||
KeyCode::F1 => {
|
||||
self.reset_position = is_pressed;
|
||||
},
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
|
@ -114,6 +120,12 @@ impl ScriptTrait for Player {
|
|||
}
|
||||
|
||||
if let Some(rigid_body) = context.scene.graph.try_get_mut_of_type::<RigidBody>(context.handle) {
|
||||
|
||||
if self.reset_position {
|
||||
rigid_body.local_transform_mut().set_position(Vector3::new(0.0, 0.0, 0.0));
|
||||
return;
|
||||
}
|
||||
|
||||
let mut velocity = Vector3::new(0.0, 0.0, 0.0);
|
||||
if self.move_forward {
|
||||
velocity += look_vector;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue