godot4-dev
Last change
on this file was 831a978, checked in by Jonathan Neufeld <support@…>, 3 years ago |
Initial commit of Godot4 project Working world and movable player.
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | extends Node
|
---|
2 |
|
---|
3 | # Player related universal vars replaced if config file under player is found.
|
---|
4 | var player = "player"
|
---|
5 | var health = 1000
|
---|
6 | var health_max = 1000
|
---|
7 | var stamina = 1000
|
---|
8 | var stamina_max = 1000
|
---|
9 | var mana = 1000
|
---|
10 | var mana_max = 1000
|
---|
11 | var lifeforce = 1000
|
---|
12 | var lifeforce_max = 1000
|
---|
13 | var xp = 0
|
---|
14 | var dead = false
|
---|
15 | var respaun = false
|
---|
16 | # Player inventory universal vars
|
---|
17 | var pickup_item
|
---|
18 |
|
---|
19 | # A variable to hold the mouse sensitivity (so Player.gd can load it)
|
---|
20 | var mouse_sensitivity = 8.0
|
---|
21 |
|
---|
22 | # Task updates hand off
|
---|
23 | var food_task = false
|
---|
24 |
|
---|
25 | # A variable to hold all of the respawn points in a level
|
---|
26 | var respawn_points = null
|
---|
27 |
|
---|
28 | # UI items
|
---|
29 | var ui_lock = false # Used to prevent player input while paused and dead.
|
---|
30 |
|
---|
31 |
|
---|
32 | # Config file key bindings
|
---|
33 | var keybind_filepath = "res://Player/keybinds.ini"
|
---|
34 | var keybind_configfile
|
---|
35 | var keybinds = {}
|
---|
36 |
|
---|
37 | # ------------------------------------
|
---|
38 |
|
---|
39 | func _ready():
|
---|
40 |
|
---|
41 | # Loads in the keybindings
|
---|
42 | keybind_configfile = ConfigFile.new()
|
---|
43 | if keybind_configfile.load(keybind_filepath) == OK:
|
---|
44 | for key in keybind_configfile.get_section_keys("keybinds"):
|
---|
45 | var key_value = keybind_configfile.get_value("keybinds", key)
|
---|
46 | if str(key_value) != "":
|
---|
47 | keybinds[key] = key_value
|
---|
48 | else:
|
---|
49 | keybinds[key] = null
|
---|
50 | else:
|
---|
51 | print("Keybinds Config File Not Found")
|
---|
52 | player = "player"
|
---|
53 | health = 1000
|
---|
54 | stamina = 1000
|
---|
55 | mana = 1000
|
---|
56 | lifeforce = 1000
|
---|
57 | xp = 0
|
---|
58 | if dead == true:
|
---|
59 | dead = false
|
---|
60 | respaun = true
|
---|
Note:
See
TracBrowser
for help on using the repository browser.