more crosshair tweaks
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user