This commit is contained in:
Felipe M 2021-05-22 18:43:03 +02:00
parent 847670821d
commit c5a54977ac
Signed by: fmartingr
GPG key ID: 716BC147715E716F
7 changed files with 16 additions and 6 deletions

View file

@ -2,4 +2,5 @@ extends Powerup
func _pickup():
PlayerStats.missiles_unlocked = true
PlayerStats.missiles += 1
queue_free()

View file

@ -57,7 +57,17 @@ func assign_world_camera():
cameraFollow.remote_path = MainInstances.WorldCamera.get_path()
func _exit_tree():
MainInstances.Player = null
# We need to check if the player in maininstances is this player instance,
# it could be a loaded player and this call is made after the new player
# is instanced and set in the MainInstances, so the new player is there and
# we set it to null, breaking the game.
if MainInstances.Player == self:
MainInstances.Player = null
# This is another solution to the above problem
# func queue_free():
# MainInstances.Player = null
# .queue_free()
func _physics_process(delta):
just_jumped = false

View file

@ -5,7 +5,7 @@ var max_health = 4
var health = max_health setget set_health
var missiles_unlocked = false setget set_missiles_unlocked
var max_missiles = 3
var missiles = max_missiles setget set_missiles
var missiles = 0 setget set_missiles
signal player_health_changed(value)
signal player_missiles_unlocked(value)