Interaction wheel
do interaction
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
[gd_resource type="Resource" script_class="Interaction" load_steps=4 format=3 uid="uid://bo3e2jefukgdy"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://n806c03hgaq1" path="res://assets/scifi_tilesheet@2.png" id="1_bglkk"]
|
||||
[ext_resource type="Script" path="res://scripts/interaction.gd" id="2_h5okx"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3e2ed"]
|
||||
atlas = ExtResource("1_bglkk")
|
||||
region = Rect2(960, 512, 64, 64)
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_h5okx")
|
||||
name = "Build"
|
||||
image = SubResource("AtlasTexture_3e2ed")
|
||||
13
data/interactions/build/build.tres
Normal file
13
data/interactions/build/build.tres
Normal file
@@ -0,0 +1,13 @@
|
||||
[gd_resource type="Resource" script_class="InteractionBuild" load_steps=4 format=3 uid="uid://bo3e2jefukgdy"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://n806c03hgaq1" path="res://assets/scifi_tilesheet@2.png" id="1_bglkk"]
|
||||
[ext_resource type="Script" path="res://data/interactions/build/interaction_build.gd" id="2_0g8r2"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_f6dt5"]
|
||||
atlas = ExtResource("1_bglkk")
|
||||
region = Rect2(960, 512, 64, 64)
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_0g8r2")
|
||||
name = "Build"
|
||||
image = SubResource("AtlasTexture_f6dt5")
|
||||
6
data/interactions/build/interaction_build.gd
Normal file
6
data/interactions/build/interaction_build.gd
Normal file
@@ -0,0 +1,6 @@
|
||||
extends Interaction
|
||||
class_name InteractionBuild
|
||||
|
||||
func interact_at(pos: Vector2i, root: Node) -> Array[Interaction]:
|
||||
print("Building at: %s" % pos)
|
||||
return []
|
||||
@@ -1,13 +0,0 @@
|
||||
[gd_resource type="Resource" script_class="Interaction" load_steps=4 format=3 uid="uid://r4evto2nkehg"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://n806c03hgaq1" path="res://assets/scifi_tilesheet@2.png" id="1_cquks"]
|
||||
[ext_resource type="Script" path="res://scripts/interaction.gd" id="1_m76d8"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_f8jvb"]
|
||||
atlas = ExtResource("1_cquks")
|
||||
region = Rect2(1024, 512, 64, 64)
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_m76d8")
|
||||
name = "Gather"
|
||||
image = SubResource("AtlasTexture_f8jvb")
|
||||
13
data/interactions/gather/gather.tres
Normal file
13
data/interactions/gather/gather.tres
Normal file
@@ -0,0 +1,13 @@
|
||||
[gd_resource type="Resource" script_class="InteractionGather" load_steps=4 format=3 uid="uid://r4evto2nkehg"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://n806c03hgaq1" path="res://assets/scifi_tilesheet@2.png" id="1_cquks"]
|
||||
[ext_resource type="Script" path="res://data/interactions/gather/interaction_gather.gd" id="2_4amum"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jjmaq"]
|
||||
atlas = ExtResource("1_cquks")
|
||||
region = Rect2(1024, 512, 64, 64)
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_4amum")
|
||||
name = "Gather"
|
||||
image = SubResource("AtlasTexture_jjmaq")
|
||||
24
data/interactions/gather/interaction_gather.gd
Normal file
24
data/interactions/gather/interaction_gather.gd
Normal file
@@ -0,0 +1,24 @@
|
||||
extends Interaction
|
||||
class_name InteractionGather
|
||||
|
||||
var interaction_display
|
||||
var _pos
|
||||
|
||||
func interact_at(pos: Vector2i, root: Node) -> Array[Interaction]:
|
||||
_pos = pos
|
||||
print("Gathering at: %s" % pos)
|
||||
|
||||
interaction_display = ProgressBar.new()
|
||||
interaction_display.position = Grid.grid_to_world_center(_pos) - Vector2(30, 10)
|
||||
interaction_display.size = Vector2(60, 20)
|
||||
interaction_display.show_percentage = false
|
||||
var tween = root.create_tween()
|
||||
tween.tween_property(interaction_display, "value", 100, 3)
|
||||
tween.tween_callback(_cleanup_gather)
|
||||
root.add_child(interaction_display)
|
||||
return []
|
||||
|
||||
func _cleanup_gather() -> void:
|
||||
interaction_display.queue_free()
|
||||
var res: GameResource = Grid.get_location_data(_pos).get_resource()
|
||||
res.gained_resource.emit(res)
|
||||
8
data/interactions/interaction.gd
Normal file
8
data/interactions/interaction.gd
Normal file
@@ -0,0 +1,8 @@
|
||||
extends Resource
|
||||
class_name Interaction
|
||||
|
||||
@export var name: String
|
||||
@export var image: AtlasTexture
|
||||
|
||||
func interact_at(pos: Vector2i, root: Node) -> Array[Interaction]:
|
||||
return []
|
||||
Reference in New Issue
Block a user