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