more crosshair tweaks

This commit is contained in:
derek
2025-03-19 14:25:21 -05:00
parent 99a2769987
commit 573a20cfa8
7 changed files with 41 additions and 34 deletions

View File

@@ -103,38 +103,36 @@ func reload_finished():
func shoot():
if GameGlobals.gun_ammo.has(weapon_info.gun_name):
if weapon_info.weapon_type == 0:
if GameGlobals.gun_ammo[weapon_info.gun_name] > 0 and cycle_count > 0:
if !anim_player.is_playing():
GameGlobals.gun_ammo[weapon_info.gun_name] -= 1
if weapon_info.fire_mode != 0:
cycle_count -= 1
#audio and anims
anim_player.play("shoot")
elif !anim_player.is_playing() and cycle_count != 0:
anim_player.play("empty")
audio_empty.play()
elif weapon_info.weapon_type == 1:
if weapon_info.weapon_type == 0:
if GameGlobals.gun_ammo[weapon_info.gun_name] > 0 and cycle_count > 0:
if !anim_player.is_playing():
GameGlobals.gun_ammo[weapon_info.gun_name] -= 1
if weapon_info.fire_mode != 0:
cycle_count -= 1
#audio and anims
anim_player.play("shoot")
vibration()
player.recoil.add_recoil(Vector3(0,weapon_info.recoil_amount.y,weapon_info.recoil_amount.z),10,10)
player.recoil.add_gun_recoil(weapon_info.recoil_amount.x)
SignalBus.emit_signal("shot_fired")
elif weapon_info.weapon_type == 2:
if !anim_player.is_playing():
if tracker == null and Input.is_action_just_pressed("shoot"):
check_track = true
weapon_info.tracker_check_mesh.visible = true
weapon_info.tracker_check_mesh.anim_player.play("check")
if tracker != null and !check_track:
anim_player.play("shoot")
elif !anim_player.is_playing() and cycle_count != 0:
anim_player.play("empty")
audio_empty.play()
elif weapon_info.weapon_type == 1:
if !anim_player.is_playing():
#audio and anims
anim_player.play("shoot")
vibration()
player.recoil.add_recoil(Vector3(0,weapon_info.recoil_amount.y,weapon_info.recoil_amount.z),10,10)
player.recoil.add_gun_recoil(weapon_info.recoil_amount.x)
elif weapon_info.weapon_type == 2:
if !anim_player.is_playing():
if tracker == null and Input.is_action_just_pressed("shoot"):
check_track = true
weapon_info.tracker_check_mesh.visible = true
weapon_info.tracker_check_mesh.anim_player.play("check")
if tracker != null and !check_track:
anim_player.play("shoot")
func reload():
match weapon_info.weapon_type:
0:
@@ -215,6 +213,7 @@ func tracker_checker(_delta):
check_track = false
func shotgun_pellet_spawn():
SignalBus.emit_signal("shot_fired",weapon_info.crosshair_jump_amount)
audio_fire.play()
spawn_casing()
var pellets_remaining = weapon_info.pellets_per_shot
@@ -263,6 +262,7 @@ func projectile_initialize():
return instance_bullet
func bullet_fire():
SignalBus.emit_signal("shot_fired",weapon_info.crosshair_jump_amount)
audio_fire.play()
get_tree().current_scene.add_child(projectile_initialize())
spawn_casing()