Update 'characters/teddy/Teddy.gd'

This commit is contained in:
Paul Black 2023-07-03 23:09:32 +00:00
parent 481b8fee79
commit f0e10a273a

View file

@ -86,18 +86,20 @@ func _physics_process(delta):
if is_multiplayer_authority(): if is_multiplayer_authority():
# This variable gets set my the death scene, so we know the player needs to be respawned # This variable gets set my the death scene, so we know the player needs to be respawned
if Global.playerPleaseRespawn == true: if Global.playerPleaseRespawn == true:
get_node(teddyCollider).disabled = false if not Global.respawnLocationChosen:
var ramMax = Global.spawnCoords_x.size() - 1 Global.respawnLocationChosen = true
var ramnum = RandomNumberGenerator.new().randi_range(0, ramMax) get_node(teddyCollider).disabled = false
print("ramnum: ", ramnum) var ramMax = Global.spawnCoords_x.size() - 1
print("ramMax: ", ramMax) var ramnum = RandomNumberGenerator.new().randi_range(0, ramMax)
position.x = Global.spawnCoords_x[ramnum] #Set player X print("ramnum: ", ramnum)
position.y = Global.spawnCoords_y[ramnum] #Set player Y print("ramMax: ", ramMax)
position.z = Global.spawnCoords_z[ramnum] #Set player Z position.x = Global.spawnCoords_x[ramnum] #Set player X
await get_tree().create_timer(0.5).timeout position.y = Global.spawnCoords_y[ramnum] #Set player Y
Global.reset_variables() position.z = Global.spawnCoords_z[ramnum] #Set player Z
ranRemovePlayer = false await get_tree().create_timer(0.5).timeout
rpc("teddy_dead_nomore") Global.reset_variables()
ranRemovePlayer = false
rpc("teddy_dead_nomore")
## If player falls off the map, kill them! ## If player falls off the map, kill them!
if velocity.y < Global.playerYDeath: if velocity.y < Global.playerYDeath: