project_teddy/scripts/global.gd

53 lines
2.3 KiB
GDScript3
Raw Normal View History

2023-01-26 12:17:54 -07:00
extends Node
var mouseSensitivity = 0.01 # Unless otherwise changed by user in settings
var playingGame = false # Should be true while in a map, set by menus
var fatigue = 100 # Makes it so you can't run forever, you have limited energy
var playerHealth = 100 # If zero, the player dies. Bullets cause damage
var playerDead = false # Defined by Global.player_dead()
var playerAlive = true # Gets set to false by death.tscn then to true after the death timer is up
var playerPleaseRespawn = false # When true, this executes the apporiate commands to respawn the player. Controlled by death.tscn
var playerYDeath = -20 # The point in which the player will die from falling off the map, defined in map scripts
var playerName # Defined in the settings-file.gd script
var deathShield = 0 # Makes you unkillable for a specified amount of time. Used to prevent the kill screen from appearing twice as well
var goScene # This is used for the sceneChangerConfirm window. Initalized by a different script prior to sceneChangerConfirm
var consoleOpen = false # This specifies whether or not the console is open
var consoleCommand # Defined by console.gd
var consoleOutput # Defined by console.gd
var godMode = false # Defined by console.gd
var selfTeddy # Defined as soon as the player script is initalized
2023-02-22 21:31:22 -07:00
var multiplayerCurrent = false # Whether the player is using multiplayer
var currentMapNode # Defined in map scripts
2023-02-25 14:31:15 -07:00
var teddyAuthorityID # Defined from teddy.gd after object is initalized
2023-03-02 12:52:49 -07:00
var miniMenuResume = false # Set to true by mainmenu.gd
func _process(delta):
if godMode:
pass
elif Input.is_action_pressed("sprint"):
if fatigue > 0:
fatigue = fatigue - 10 * delta
elif not Input.is_action_pressed("sprint"):
if fatigue < 100:
fatigue = fatigue + 2 * delta
if playerAlive:
deathShield = deathShield - 10 * delta # Make player not killable until the value falls below 0
func player_dead():
playerDead = true
if deathShield <= 0:
deathShield = 50
if playerAlive:
print("Player be deaddddd brooooooo")
var scene_trs =load("res://scenes/death.tscn")
var scene=scene_trs.instantiate()
add_child(scene)
2023-02-07 13:22:31 -07:00
func reset_variables():
print("Variables were reset by something")
fatigue = 100
playerHealth = 100
playerDead = false
playerAlive = true
playerPleaseRespawn = false
2023-02-15 23:41:14 -07:00