Add a system for changing tools
This commit is contained in:
@ -14,8 +14,17 @@ var status = {
|
||||
"health": 100,
|
||||
"stamina": 100
|
||||
}
|
||||
var current_tool = "none"
|
||||
|
||||
|
||||
func change_tool(tool):
|
||||
current_tool = tool
|
||||
$body_pivot/body/tool.texture = load(game_data.tools[tool].image)
|
||||
$body_pivot/body/tool.position = game_data.tools[tool].offset
|
||||
|
||||
func _ready():
|
||||
change_tool("stick")
|
||||
|
||||
func _physics_process(delta):
|
||||
var pre_velocity = Vector2(0, 0)
|
||||
if !immobile:
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://gfxfxkfu8uk4" path="res://textures/character/character.svg" id="1_f7cgp"]
|
||||
[ext_resource type="Script" path="res://data/character/character.gd" id="1_qlitf"]
|
||||
[ext_resource type="Texture2D" uid="uid://b7hh5vuwdmg0v" path="res://textures/tools/stick.svg" id="3_1h5n2"]
|
||||
[ext_resource type="Texture2D" uid="uid://crw5j541ciab8" path="res://textures/tools/none.svg" id="3_c34pt"]
|
||||
[ext_resource type="Script" path="res://data/character/hud.gd" id="3_eogh2"]
|
||||
[ext_resource type="Texture2D" uid="uid://ttb1b3k07qu5" path="res://textures/world/boulder.svg" id="4_t4sgq"]
|
||||
[ext_resource type="Texture2D" uid="uid://i7fjjduk8b0c" path="res://textures/world/biome/forest/tree.svg" id="5_j15j3"]
|
||||
@ -78,7 +78,7 @@ texture = ExtResource("1_f7cgp")
|
||||
[node name="tool" type="Sprite2D" parent="body_pivot/body"]
|
||||
z_index = -1
|
||||
position = Vector2(-80, -120)
|
||||
texture = ExtResource("3_1h5n2")
|
||||
texture = ExtResource("3_c34pt")
|
||||
|
||||
[node name="hud" type="Control" parent="."]
|
||||
z_index = 10
|
||||
|
Reference in New Issue
Block a user