revolver tweaks, mostly just needs chamber to rotate instead of snap
This commit is contained in:
@@ -48,7 +48,6 @@ var cycle_count
|
||||
@export_subgroup("Raycast Nodes")
|
||||
@export var anim_player : Node
|
||||
@export var barrel_raycast : Node
|
||||
@export var casing_ejectors : Node
|
||||
@export_subgroup("Audio Clips")
|
||||
@export var audio_fire : Node
|
||||
@export var audio_empty : Node
|
||||
@@ -125,18 +124,15 @@ func reload_finished():
|
||||
player.reloading = false
|
||||
|
||||
func shoot(player,delta):
|
||||
|
||||
if level_control.ammo_current[gun_index] > 0 and cycle_count > 0:
|
||||
if !anim_player.is_playing():
|
||||
level_control.ammo_current[gun_index] -= 1
|
||||
#RECOIL --- fix later to happen over a period of time
|
||||
#player.camera.rotation.x = clamp(lerp(player.camera.rotation.x, player.camera.rotation.x + recoil_amount, delta * 10), deg_to_rad(-90), deg_to_rad(60))
|
||||
#(ADD PLAYER KICK HERE. RELATIVE TO GUN POSITION)
|
||||
audio_fire.pitch_scale = 1 + rng.randf_range(-fire_pitch_scale_amt,fire_pitch_scale_amt)
|
||||
audio_fire.play()
|
||||
anim_player.play("shoot")
|
||||
# instance bullet
|
||||
anim_player.play("shoot") #actual bullet spawn triggered by animation
|
||||
|
||||
if fire_mode != 0:
|
||||
cycle_count -= 1
|
||||
|
||||
elif !anim_player.is_playing() and cycle_count != 0:
|
||||
anim_player.play("empty")
|
||||
@@ -158,10 +154,8 @@ func fire(delta):
|
||||
instance_bullet.gun = self
|
||||
get_tree().get_root().add_child(instance_bullet)
|
||||
player.weapon_recoil()
|
||||
# chamberspin transform
|
||||
#DO SOMETHING HERE
|
||||
if fire_mode != 0:
|
||||
cycle_count -= 1
|
||||
chamber.rotate_object_local(Vector3(0,-1,0),deg_to_rad(60))
|
||||
|
||||
|
||||
func reload(player,delta):
|
||||
if level_control.ammo_current[gun_index] < max_ammo and player.reloading == false and level_control.ammo_reserve[gun_index] > 0:
|
||||
@@ -175,6 +169,7 @@ func reload(player,delta):
|
||||
|
||||
func spawn_casings():
|
||||
for i in casing_array:
|
||||
i.visible = false
|
||||
if casings_chamber_last > 0:
|
||||
var instance_casing = spawn_casing.instantiate()
|
||||
instance_casing.position = i.global_position
|
||||
|
||||
Reference in New Issue
Block a user