testing how branches work
This commit is contained in:
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
[.ShellClassInfo]
|
||||
IconResource=C:\Program Files\Google\Drive File Stream\93.0.1.0\GoogleDriveFS.exe,25
|
||||
@@ -55,3 +55,44 @@ func _on_gun_anims_animation_finished(anim_name):
|
||||
player.ammo += player.ammo_reserve
|
||||
player.ammo_reserve -= player.ammo_reserve
|
||||
player.reloading = false
|
||||
|
||||
func shoot():
|
||||
if ammo > 0:
|
||||
if !gun.anim_player.is_playing():
|
||||
ammo -= 1
|
||||
#RECOIL fix later to happen over a period of time
|
||||
camera.rotation.x = clamp(lerp(camera.rotation.x, camera.rotation.x + gun.recoil_amount, delta * 10), deg_to_rad(-90), deg_to_rad(60))
|
||||
#(ADD PLAYER KICK HERE. RELATIVE TO GUN POSITION)
|
||||
gun.audio_fire.pitch_scale = 1 + rng.randf_range(-.2,.2)
|
||||
gun.audio_fire.play()
|
||||
gun.anim_player.play("shoot")
|
||||
|
||||
# shoot real bullet from camera
|
||||
if gun_folded == false:
|
||||
instance_bullet = gun.bullet.instantiate()
|
||||
instance_bullet.position = bullet_ray.global_position
|
||||
instance_bullet.transform.basis = bullet_ray.global_transform.basis
|
||||
instance_bullet.bullet_speed = gun.bullet_speed
|
||||
instance_bullet.bullet_drop = gun.bullet_drop
|
||||
instance_bullet.random_spread_amt = gun.random_spread_amt
|
||||
instance_bullet.gun = gun
|
||||
get_parent().add_child(instance_bullet)
|
||||
else:
|
||||
instance_bullet = gun.bullet.instantiate()
|
||||
instance_bullet.position = gun.barrel_raycast.global_position
|
||||
instance_bullet.transform.basis = gun.barrel_raycast.global_transform.basis
|
||||
instance_bullet.bullet_speed = gun.bullet_speed
|
||||
instance_bullet.bullet_drop = gun.bullet_drop
|
||||
instance_bullet.random_spread_amt = gun.random_spread_amt
|
||||
instance_bullet.gun = gun
|
||||
get_parent().add_child(instance_bullet)
|
||||
|
||||
# Casing transform
|
||||
instance_casing = gun.casing.instantiate()
|
||||
instance_casing.position = gun.casing_ejector.global_position
|
||||
instance_casing.transform.basis = gun.casing_ejector.global_transform.basis
|
||||
|
||||
get_parent().add_child(instance_casing)
|
||||
elif !gun.anim_player.is_playing():
|
||||
gun.anim_player.play("empty")
|
||||
gun.audio_empty.play()
|
||||
|
||||
@@ -171,45 +171,7 @@ func _physics_process(delta):
|
||||
|
||||
# Shooting
|
||||
if Input.is_action_pressed("shoot"):
|
||||
if ammo > 0:
|
||||
if !gun.anim_player.is_playing():
|
||||
ammo -= 1
|
||||
#RECOIL fix later to happen over a period of time
|
||||
camera.rotation.x = clamp(lerp(camera.rotation.x, camera.rotation.x + gun.recoil_amount, delta * 10), deg_to_rad(-90), deg_to_rad(60))
|
||||
#(ADD PLAYER KICK HERE. RELATIVE TO GUN POSITION)
|
||||
gun.audio_fire.pitch_scale = 1 + rng.randf_range(-.2,.2)
|
||||
gun.audio_fire.play()
|
||||
gun.anim_player.play("shoot")
|
||||
|
||||
# shoot real bullet from camera
|
||||
if gun_folded == false:
|
||||
instance_bullet = gun.bullet.instantiate()
|
||||
instance_bullet.position = bullet_ray.global_position
|
||||
instance_bullet.transform.basis = bullet_ray.global_transform.basis
|
||||
instance_bullet.bullet_speed = gun.bullet_speed
|
||||
instance_bullet.bullet_drop = gun.bullet_drop
|
||||
instance_bullet.random_spread_amt = gun.random_spread_amt
|
||||
instance_bullet.gun = gun
|
||||
get_parent().add_child(instance_bullet)
|
||||
else:
|
||||
instance_bullet = gun.bullet.instantiate()
|
||||
instance_bullet.position = gun.barrel_raycast.global_position
|
||||
instance_bullet.transform.basis = gun.barrel_raycast.global_transform.basis
|
||||
instance_bullet.bullet_speed = gun.bullet_speed
|
||||
instance_bullet.bullet_drop = gun.bullet_drop
|
||||
instance_bullet.random_spread_amt = gun.random_spread_amt
|
||||
instance_bullet.gun = gun
|
||||
get_parent().add_child(instance_bullet)
|
||||
|
||||
# Casing transform
|
||||
instance_casing = gun.casing.instantiate()
|
||||
instance_casing.position = gun.casing_ejector.global_position
|
||||
instance_casing.transform.basis = gun.casing_ejector.global_transform.basis
|
||||
|
||||
get_parent().add_child(instance_casing)
|
||||
elif !gun.anim_player.is_playing():
|
||||
gun.anim_player.play("empty")
|
||||
gun.audio_empty.play()
|
||||
gun.shoot()
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user