more hub world tweaking
This commit is contained in:
@@ -105,9 +105,9 @@ func _process(delta):
|
||||
|
||||
func reload_finished():
|
||||
#if max ammo in reserve fill all the way
|
||||
if player.ammo_reserve[str(ammo_type)] >= max_ammo:
|
||||
player.gun_ammo[gun_name] += max_ammo
|
||||
player.ammo_reserve[str(ammo_type)] -= max_ammo
|
||||
if GameGlobals.ammo_reserve[str(ammo_type)] >= max_ammo:
|
||||
GameGlobals.gun_ammo[gun_name] += max_ammo
|
||||
GameGlobals.ammo_reserve[str(ammo_type)] -= max_ammo
|
||||
casings_chamber_last = max_ammo
|
||||
for i in casing_array:
|
||||
i.visible = true
|
||||
@@ -116,10 +116,10 @@ func reload_finished():
|
||||
player.reloading = false
|
||||
#if not max ammo in reserve add remaining ammo
|
||||
else:
|
||||
player.gun_ammo[gun_name] += player.ammo_reserve[str(ammo_type)]
|
||||
var casings_in_chamber = player.ammo_reserve[str(ammo_type)]
|
||||
casings_chamber_last = player.ammo_reserve[str(ammo_type)]
|
||||
player.ammo_reserve[str(ammo_type)] -= player.ammo_reserve[str(ammo_type)]
|
||||
GameGlobals.gun_ammo[gun_name] += GameGlobals.ammo_reserve[str(ammo_type)]
|
||||
var casings_in_chamber = GameGlobals.ammo_reserve[str(ammo_type)]
|
||||
casings_chamber_last = GameGlobals.ammo_reserve[str(ammo_type)]
|
||||
GameGlobals.ammo_reserve[str(ammo_type)] -= GameGlobals.ammo_reserve[str(ammo_type)]
|
||||
|
||||
while casings_in_chamber > 0:
|
||||
casing_array[casings_in_chamber].visible = true
|
||||
@@ -129,9 +129,9 @@ func reload_finished():
|
||||
player.reloading = false
|
||||
|
||||
func shoot(delta):
|
||||
if player.gun_ammo[gun_name] > 0 and cycle_count > 0:
|
||||
if GameGlobals.gun_ammo[gun_name] > 0 and cycle_count > 0:
|
||||
if !anim_player.is_playing():
|
||||
player.gun_ammo[gun_name] -= 1
|
||||
GameGlobals.gun_ammo[gun_name] -= 1
|
||||
audio_fire.pitch_scale = 1 + rng.randf_range(-fire_pitch_scale_amt,fire_pitch_scale_amt)
|
||||
audio_fire.play()
|
||||
anim_player.play("shoot") #actual bullet spawn triggered by animation
|
||||
@@ -166,13 +166,13 @@ func fire(delta):
|
||||
Input.start_joy_vibration(0,.5,.9,.2)
|
||||
|
||||
func reload():
|
||||
if player.gun_ammo[gun_name] < max_ammo and player.gun.anim_player.get_current_animation() != "reload" and player.ammo_reserve[str(ammo_type)] > 0:
|
||||
if GameGlobals.gun_ammo[gun_name] < max_ammo and player.gun.anim_player.get_current_animation() != "reload" and GameGlobals.ammo_reserve[str(ammo_type)] > 0:
|
||||
anim_player.play("reload")
|
||||
audio_reload.play()
|
||||
for i in bullet_array:
|
||||
i.visible = false
|
||||
if anim_player.is_playing() and anim_player.current_animation == "reload":
|
||||
player.gun_ammo[gun_name] = 0
|
||||
GameGlobals.gun_ammo[gun_name] = 0
|
||||
|
||||
func spawn_casings():
|
||||
for i in casing_array:
|
||||
|
||||
Reference in New Issue
Block a user