68 lines
3.4 KiB
GDScript
68 lines
3.4 KiB
GDScript
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
|
|
var multiplayerCurrent = false # Whether the player is using multiplayer
|
|
var currentMapNode # Defined in map scripts
|
|
var teddyAuthorityID # Defined from teddy.gd after object is initalized
|
|
var miniMenuResume = false # Set to true by mainmenu.gd
|
|
var roundInSession = false # Goes true once the round is started in Teddy.gd
|
|
var HUDStartLabelText = "" # The text displayed at the bottom of the screen of the server
|
|
var lastPersonToHitMe = 0 # Defined in the Bullet RPC
|
|
var HUDPlayerDied = false # Tells the HUD.gd script that a point should be added or deducted
|
|
var connectedPlayers = [] # Currently connected players by their name (NOT THEIR ID)
|
|
var connectedPlayersByPeerID = [] # Currently connected players by their ID
|
|
var respawnTimeModifier = 1.0 # Affects how quickly the player respawns in death.gd
|
|
var musicName = "" # Name of music for HUD.gd
|
|
var musicAuthor = "" # Name of music author for HUD.gd
|
|
var musicUpdated = false # Tells HUD.gd to update labels and change visibility
|
|
var menuLightSwitch = false # No description provided
|
|
var gamemode = "Deathmatch" # This is changed in host.gd
|
|
var chosenRunner # Changed in HUD.gd
|
|
var iAmRunner = false # Defines whether you're the runner or not. Used in HUD.gd
|
|
var runnerDead = false # When the runner is dead, this goes true
|
|
var roundTimer = 300.0 # How long each rounds goes
|
|
|
|
func _process(delta):
|
|
if godMode:
|
|
pass
|
|
elif Input.is_action_pressed("sprint") and not iAmRunner and roundInSession:
|
|
if fatigue > 0:
|
|
fatigue = fatigue - 10 * delta
|
|
elif not Input.is_action_pressed("sprint"):
|
|
if fatigue < 100:
|
|
fatigue = fatigue + 5 * 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)
|
|
|
|
func reset_variables():
|
|
print("Variables were reset by something")
|
|
fatigue = 100
|
|
playerHealth = 100
|
|
playerDead = false
|
|
playerAlive = true
|
|
playerPleaseRespawn = false
|
|
|