Compare commits
8 Commits
294ac0289a
...
aca0498555
| Author | SHA1 | Date | |
|---|---|---|---|
| aca0498555 | |||
| bf2148db57 | |||
| ba20354ee7 | |||
| 660af9a27a | |||
| a91ca5f7f1 | |||
| d2742231e6 | |||
|
|
bca2300443 | ||
| b164141d00 |
1
common/inventory/assets/icons/scuba-diving-tank.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#ffffff" class="icon icon-tabler icons-tabler-filled icon-tabler-scuba-diving-tank"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M17 17v2a3 3 0 0 1 -3 3h-4a3 3 0 0 1 -3 -3v-2z" /><path d="M8 2a2 2 0 0 1 1.732 1h1.15a1.496 1.496 0 0 1 2.236 0h1.882a1 1 0 0 1 0 2l-1.883 .001a2 2 0 0 1 -.115 .116v.983a5 5 0 0 1 3.998 4.9v4h-10v-4a5 5 0 0 1 4 -4.9v-.983a2 2 0 0 1 -.117 -.116h-1.151a2 2 0 1 1 -1.732 -3.001" /></svg>
|
||||||
|
After Width: | Height: | Size: 524 B |
37
common/inventory/assets/icons/scuba-diving-tank.svg.import
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bo3o2qf3i20ke"
|
||||||
|
path="res://.godot/imported/scuba-diving-tank.svg-d6c94087bb8fe7a9f788baf1911a56a2.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://common/inventory/assets/icons/scuba-diving-tank.svg"
|
||||||
|
dest_files=["res://.godot/imported/scuba-diving-tank.svg-d6c94087bb8fe7a9f788baf1911a56a2.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
svg/scale=2.0
|
||||||
|
editor/scale_with_editor_scale=false
|
||||||
|
editor/convert_colors_with_editor_theme=false
|
||||||
1
common/inventory/assets/icons/shovel.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-shovel"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M17 4l3 3" /><path d="M18.5 5.5l-8 8" /><path d="M8.276 11.284l4.44 4.44a.968 .968 0 0 1 0 1.369l-2.704 2.704a4.108 4.108 0 0 1 -5.809 -5.81l2.704 -2.703a.968 .968 0 0 1 1.37 0z" /></svg>
|
||||||
|
After Width: | Height: | Size: 498 B |
37
common/inventory/assets/icons/shovel.svg.import
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bf6nw4onkhavr"
|
||||||
|
path="res://.godot/imported/shovel.svg-f17d484b3a88170abdf08077458176fb.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://common/inventory/assets/icons/shovel.svg"
|
||||||
|
dest_files=["res://.godot/imported/shovel.svg-f17d484b3a88170abdf08077458176fb.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
svg/scale=2.0
|
||||||
|
editor/scale_with_editor_scale=false
|
||||||
|
editor/convert_colors_with_editor_theme=false
|
||||||
11
common/inventory/resources/items/default_seed.tres
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[gd_resource type="Resource" script_class="SeedItem" load_steps=3 format=3 uid="uid://lrl2okkhyxmx"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://gui/player_info/assets/icons/bolt.svg" id="1_dy25s"]
|
||||||
|
[ext_resource type="Script" uid="uid://bypjcvlc15gsm" path="res://common/inventory/scripts/items/seed_item.gd" id="2_mgcdi"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("2_mgcdi")
|
||||||
|
plant_type = ""
|
||||||
|
name = "Boule"
|
||||||
|
icon = ExtResource("1_dy25s")
|
||||||
|
metadata/_custom_type_script = "uid://bypjcvlc15gsm"
|
||||||
11
common/inventory/resources/items/shovel.tres
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[gd_resource type="Resource" script_class="Item" load_steps=3 format=3 uid="uid://bb8etgye1qtfx"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bq7admu4ahs5r" path="res://common/inventory/scripts/item.gd" id="1_0wi27"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bf6nw4onkhavr" path="res://common/inventory/assets/icons/shovel.svg" id="1_cxwlc"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_0wi27")
|
||||||
|
name = "Shovel"
|
||||||
|
description = "Transform plants to seeds"
|
||||||
|
icon = ExtResource("1_cxwlc")
|
||||||
|
metadata/_custom_type_script = "uid://bq7admu4ahs5r"
|
||||||
11
common/inventory/resources/items/water_can.tres
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[gd_resource type="Resource" script_class="Item" load_steps=3 format=3 uid="uid://dbja8xm7ehw1v"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bo3o2qf3i20ke" path="res://common/inventory/assets/icons/scuba-diving-tank.svg" id="1_sy4rh"]
|
||||||
|
[ext_resource type="Script" uid="uid://bq7admu4ahs5r" path="res://common/inventory/scripts/item.gd" id="2_aikyk"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("2_aikyk")
|
||||||
|
name = "Water Can"
|
||||||
|
description = "Water all plants"
|
||||||
|
icon = ExtResource("1_sy4rh")
|
||||||
|
metadata/_custom_type_script = "uid://bq7admu4ahs5r"
|
||||||
46
common/inventory/scripts/inventory.gd
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
extends Resource
|
||||||
|
class_name Inventory
|
||||||
|
|
||||||
|
signal inventory_changed(inventory: Inventory)
|
||||||
|
|
||||||
|
@export var items: Array[Item] = []
|
||||||
|
@export var max_items: int = 1
|
||||||
|
|
||||||
|
func add_item(item: Item):
|
||||||
|
if items.size() < max_items:
|
||||||
|
items.append(item)
|
||||||
|
emit_signal("inventory_changed", self)
|
||||||
|
return true
|
||||||
|
else:
|
||||||
|
return false
|
||||||
|
|
||||||
|
func add_items(items_to_add: Array[Item], fillup: bool = false):
|
||||||
|
if fillup:
|
||||||
|
var has_changed := false
|
||||||
|
for i in min(items_to_add.size(), max_items - items.size()):
|
||||||
|
items.append(items_to_add[i])
|
||||||
|
has_changed = true
|
||||||
|
if has_changed:
|
||||||
|
emit_signal("inventory_changed", self)
|
||||||
|
return has_changed
|
||||||
|
elif !fillup && items.size() + items_to_add.size() < max_items:
|
||||||
|
items.append_array(items_to_add)
|
||||||
|
emit_signal("inventory_changed", self)
|
||||||
|
return true
|
||||||
|
|
||||||
|
func lenght() -> int:
|
||||||
|
return len(items)
|
||||||
|
|
||||||
|
func get_item(ind: int = 0):
|
||||||
|
return items[ind]
|
||||||
|
|
||||||
|
func pop_item(ind: int = 0):
|
||||||
|
var item_removed: Item = items.pop_at(ind)
|
||||||
|
emit_signal("inventory_changed", self)
|
||||||
|
return item_removed
|
||||||
|
|
||||||
|
func swap_items(item_to_add: Item, ind_to_get: int = 0):
|
||||||
|
var item_to_get := items[ind_to_get]
|
||||||
|
items[ind_to_get] = item_to_add
|
||||||
|
emit_signal("inventory_changed", self)
|
||||||
|
return item_to_get
|
||||||
1
common/inventory/scripts/inventory.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://fnu2d6wna4yc
|
||||||
12
common/inventory/scripts/item.gd
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
extends Resource
|
||||||
|
class_name Item
|
||||||
|
|
||||||
|
@export var name: String
|
||||||
|
@export var description: String
|
||||||
|
@export var icon: Texture2D
|
||||||
|
|
||||||
|
func can_use() -> bool:
|
||||||
|
return false
|
||||||
|
|
||||||
|
func use() -> bool:
|
||||||
|
return false
|
||||||
1
common/inventory/scripts/item.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://bq7admu4ahs5r
|
||||||
11
common/inventory/scripts/items/seed_item.gd
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
extends Item
|
||||||
|
class_name SeedItem
|
||||||
|
|
||||||
|
@export var plant_type: PlantType
|
||||||
|
|
||||||
|
func _init():
|
||||||
|
if plant_type:
|
||||||
|
if plant_type.name:
|
||||||
|
name = plant_type.name
|
||||||
|
if plant_type.seed_texture:
|
||||||
|
icon = plant_type.seed_texture
|
||||||
1
common/inventory/scripts/items/seed_item.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://bypjcvlc15gsm
|
||||||
52
entities/interactables/item_object/assets/sprites/shadow.svg
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
width="24"
|
||||||
|
height="24"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="#ffffff"
|
||||||
|
stroke-width="2"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
class="icon icon-tabler icons-tabler-outline icon-tabler-shovel"
|
||||||
|
version="1.1"
|
||||||
|
id="svg4"
|
||||||
|
sodipodi:docname="shadow.svg"
|
||||||
|
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview4"
|
||||||
|
pagecolor="#505050"
|
||||||
|
bordercolor="#ffffff"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:showpageshadow="0"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pagecheckerboard="1"
|
||||||
|
inkscape:deskcolor="#505050"
|
||||||
|
inkscape:zoom="26.162951"
|
||||||
|
inkscape:cx="12.479479"
|
||||||
|
inkscape:cy="16.320789"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1009"
|
||||||
|
inkscape:window-x="-8"
|
||||||
|
inkscape:window-y="-8"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg4" />
|
||||||
|
<path
|
||||||
|
stroke="none"
|
||||||
|
d="M0 0h24v24H0z"
|
||||||
|
fill="none"
|
||||||
|
id="path1" />
|
||||||
|
<ellipse
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:square"
|
||||||
|
id="path4"
|
||||||
|
cx="12"
|
||||||
|
cy="12"
|
||||||
|
rx="11.73415"
|
||||||
|
ry="3.9113834" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,37 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://c1eiu5ag7lcp8"
|
||||||
|
path="res://.godot/imported/shadow.svg-3484c898461c709704cdbeef0cc1d3c3.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://entities/interactables/item_object/assets/sprites/shadow.svg"
|
||||||
|
dest_files=["res://.godot/imported/shadow.svg-3484c898461c709704cdbeef0cc1d3c3.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
svg/scale=2.0
|
||||||
|
editor/scale_with_editor_scale=false
|
||||||
|
editor/convert_colors_with_editor_theme=false
|
||||||
6
entities/interactables/item_object/item_object.tscn
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://cd3re3552pt7m"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dedg615xudpoq" path="res://entities/interactables/item_object/script/item_object.gd" id="1_hxea8"]
|
||||||
|
|
||||||
|
[node name="ItemObject" type="Area2D"]
|
||||||
|
script = ExtResource("1_hxea8")
|
||||||
106
entities/interactables/item_object/item_object_sprite.tscn
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
[gd_scene load_steps=6 format=3 uid="uid://bcj812ox8xv2t"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bf6nw4onkhavr" path="res://common/inventory/assets/icons/shovel.svg" id="1_7u8ru"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://c1eiu5ag7lcp8" path="res://entities/interactables/item_object/assets/sprites/shadow.svg" id="2_ng201"]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_ng201"]
|
||||||
|
resource_name = "default"
|
||||||
|
length = 2.0
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:position")
|
||||||
|
tracks/0/interp = 2
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1, 2),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0, 0), Vector2(0, -5), Vector2(0, 0)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Shadow:position")
|
||||||
|
tracks/1/interp = 2
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1, 2),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0, 23), Vector2(0, 28), Vector2(0, 23)]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Shadow:scale")
|
||||||
|
tracks/2/interp = 2
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1, 2),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0.875, 0.875), Vector2(0.7, 0.7), Vector2(0.875, 0.875)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_wing4"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:position")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0, 0)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Shadow:position")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0, 23)]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Shadow:scale")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0.875, 0.875)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ng3e4"]
|
||||||
|
_data = {
|
||||||
|
&"RESET": SubResource("Animation_wing4"),
|
||||||
|
&"default": SubResource("Animation_ng201")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="ItemObjectSprite" type="Sprite2D"]
|
||||||
|
texture = ExtResource("1_7u8ru")
|
||||||
|
|
||||||
|
[node name="Shadow" type="Sprite2D" parent="."]
|
||||||
|
modulate = Color(1, 1, 1, 0.227451)
|
||||||
|
z_index = -1
|
||||||
|
position = Vector2(0, 23)
|
||||||
|
scale = Vector2(0.875, 0.875)
|
||||||
|
texture = ExtResource("2_ng201")
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
&"": SubResource("AnimationLibrary_ng3e4")
|
||||||
|
}
|
||||||
|
autoplay = "default"
|
||||||
48
entities/interactables/item_object/script/item_object.gd
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
extends Interactable
|
||||||
|
class_name ItemObject
|
||||||
|
|
||||||
|
const ITEM_AREA_WIDTH = 10
|
||||||
|
const SPRITE_SCENE : PackedScene = preload("res://entities/interactables/item_object/item_object_sprite.tscn")
|
||||||
|
|
||||||
|
@export var item : Item :
|
||||||
|
set(_item):
|
||||||
|
item = _item
|
||||||
|
if sprite:
|
||||||
|
sprite.texture = item.icon
|
||||||
|
|
||||||
|
@onready var sprite : Sprite2D = generate_sprite()
|
||||||
|
|
||||||
|
func _init(_item = null):
|
||||||
|
if _item:
|
||||||
|
item = _item
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
generate_collision(10)
|
||||||
|
|
||||||
|
func interact(player : Player) -> bool:
|
||||||
|
if player.inventory.lenght() < player.inventory.max_items:
|
||||||
|
player.inventory.add_item(item)
|
||||||
|
pickup_animation(player)
|
||||||
|
else :
|
||||||
|
var swaped_item = player.inventory.swap_items(item)
|
||||||
|
item = swaped_item
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
||||||
|
func pickup_animation(player : Player):
|
||||||
|
available = false
|
||||||
|
var tween : Tween = get_tree().create_tween()
|
||||||
|
|
||||||
|
tween.tween_property(self, "position", player.position, 0.2)
|
||||||
|
tween.tween_callback(
|
||||||
|
func():
|
||||||
|
queue_free()
|
||||||
|
)
|
||||||
|
|
||||||
|
func generate_sprite() -> Sprite2D:
|
||||||
|
var s = SPRITE_SCENE.instantiate() as Sprite2D
|
||||||
|
add_child(s)
|
||||||
|
|
||||||
|
s.texture = item.icon
|
||||||
|
|
||||||
|
return s
|
||||||
@ -0,0 +1 @@
|
|||||||
|
uid://dedg615xudpoq
|
||||||
@ -1,40 +0,0 @@
|
|||||||
[gd_scene load_steps=8 format=3 uid="uid://clpcqkdlj3d8e"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cega715smavh3" path="res://entities/interactables/plants/scripts/plant.gd" id="1_d8u7e"]
|
|
||||||
[ext_resource type="Script" uid="uid://yutflvdgdk04" path="res://entities/interactables/scripts/interactable_action.gd" id="2_rs46h"]
|
|
||||||
[ext_resource type="Resource" uid="uid://bk0kop0m75pjy" path="res://entities/interactables/resources/actions/default_water_plant.tres" id="3_5foug"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://c6vby5r0pfni2" path="res://entities/interactables/plants/assets/sprites/default_plant.png" id="4_dq24f"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://b3wom2xu26g43" path="res://entities/interactables/plants/assets/sprites/default_plant_glowing.png" id="5_2gcie"]
|
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_cdbrd"]
|
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id="SpriteFrames_ocwgi"]
|
|
||||||
animations = [{
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": ExtResource("4_dq24f")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"default",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": ExtResource("5_2gcie")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"watered",
|
|
||||||
"speed": 5.0
|
|
||||||
}]
|
|
||||||
|
|
||||||
[node name="DefaultPlant" type="Area2D"]
|
|
||||||
script = ExtResource("1_d8u7e")
|
|
||||||
actions = Array[ExtResource("2_rs46h")]([ExtResource("3_5foug")])
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
|
||||||
scale = Vector2(4.01154, 4.01154)
|
|
||||||
shape = SubResource("CircleShape2D_cdbrd")
|
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
|
||||||
scale = Vector2(0.160462, 0.160462)
|
|
||||||
sprite_frames = SubResource("SpriteFrames_ocwgi")
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
extends Interactable
|
|
||||||
class_name Plant
|
|
||||||
|
|
||||||
var watered : bool = false : set = set_watered
|
|
||||||
|
|
||||||
func set_watered(_watered):
|
|
||||||
watered = _watered
|
|
||||||
$AnimatedSprite2D.play("watered" if watered else "default")
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
[gd_resource type="Resource" script_class="WaterPlantAction" load_steps=2 format=3 uid="uid://bk0kop0m75pjy"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bb38yqsd072ws" path="res://entities/interactables/scripts/actions/water_plant.gd" id="1_ghdb0"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("1_ghdb0")
|
|
||||||
metadata/_custom_type_script = "uid://bb38yqsd072ws"
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
extends InteractableAction
|
|
||||||
class_name WaterPlantAction
|
|
||||||
|
|
||||||
func action(_p: Player, _i : Interactable):
|
|
||||||
if _i is Plant:
|
|
||||||
_i.watered = true
|
|
||||||
else :
|
|
||||||
printerr("No plant selected or interactable is not a plant")
|
|
||||||
@ -1 +0,0 @@
|
|||||||
uid://bb38yqsd072ws
|
|
||||||
@ -1,8 +1,19 @@
|
|||||||
extends Area2D
|
extends Area2D
|
||||||
class_name Interactable
|
class_name Interactable
|
||||||
|
|
||||||
@export var actions : Array[InteractableAction] = [];
|
var available : bool = true
|
||||||
|
|
||||||
func interact(p : Player):
|
func _ready():
|
||||||
for a in actions:
|
printerr("Abstract Interactable class used")
|
||||||
a.action(p, self)
|
|
||||||
|
func interact(_p : Player) -> bool:
|
||||||
|
printerr("Interact function called on abstract Interactable class")
|
||||||
|
return false
|
||||||
|
|
||||||
|
func generate_collision(area_width : float):
|
||||||
|
var collision = CollisionShape2D.new()
|
||||||
|
var collision_shape = CircleShape2D.new()
|
||||||
|
collision_shape.radius = area_width
|
||||||
|
|
||||||
|
collision.shape = collision_shape
|
||||||
|
add_child(collision)
|
||||||
@ -1,6 +0,0 @@
|
|||||||
# Classe abstraite permettant de développer diverses actions
|
|
||||||
extends Resource
|
|
||||||
class_name InteractableAction
|
|
||||||
|
|
||||||
func action(_p: Player, _i : Interactable):
|
|
||||||
printerr("Méthode action de la classe abstraite InteractableAction appelée")
|
|
||||||
@ -1 +0,0 @@
|
|||||||
uid://yutflvdgdk04
|
|
||||||
BIN
entities/plants/assets/sprites/default/growing.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
34
entities/plants/assets/sprites/default/growing.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://c7mp7tkkkk6o5"
|
||||||
|
path="res://.godot/imported/growing.png-3f6fb3171589f3a22ebfeda1a4575199.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://entities/plants/assets/sprites/default/growing.png"
|
||||||
|
dest_files=["res://.godot/imported/growing.png-3f6fb3171589f3a22ebfeda1a4575199.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
BIN
entities/plants/assets/sprites/default/mature.png
Normal file
|
After Width: | Height: | Size: 149 KiB |
34
entities/plants/assets/sprites/default/mature.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bupl1y0cfj21q"
|
||||||
|
path="res://.godot/imported/mature.png-f8b2b72a84e90cfc6bf925d1d48f7f7e.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://entities/plants/assets/sprites/default/mature.png"
|
||||||
|
dest_files=["res://.godot/imported/mature.png-f8b2b72a84e90cfc6bf925d1d48f7f7e.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
BIN
entities/plants/assets/sprites/default/planted.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
34
entities/plants/assets/sprites/default/planted.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://ba413oun7ry78"
|
||||||
|
path="res://.godot/imported/planted.png-2c23372e71d0997d310374f47bb48594.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://entities/plants/assets/sprites/default/planted.png"
|
||||||
|
dest_files=["res://.godot/imported/planted.png-2c23372e71d0997d310374f47bb48594.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
@ -3,15 +3,15 @@
|
|||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://c6vby5r0pfni2"
|
uid="uid://c6vby5r0pfni2"
|
||||||
path="res://.godot/imported/default_plant.png-bbc4a8928e27ae5fc30489a97257bdb9.ctex"
|
path="res://.godot/imported/default_plant.png-0e29f01fe7666058a9a8c53076d3ea4d.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entities/interactables/plants/assets/sprites/default_plant.png"
|
source_file="res://entities/plants/assets/sprites/default_plant.png"
|
||||||
dest_files=["res://.godot/imported/default_plant.png-bbc4a8928e27ae5fc30489a97257bdb9.ctex"]
|
dest_files=["res://.godot/imported/default_plant.png-0e29f01fe7666058a9a8c53076d3ea4d.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 169 KiB After Width: | Height: | Size: 169 KiB |
@ -3,15 +3,15 @@
|
|||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://b3wom2xu26g43"
|
uid="uid://b3wom2xu26g43"
|
||||||
path="res://.godot/imported/default_plant_glowing.png-09ba534646a860193c36fa40d5f83142.ctex"
|
path="res://.godot/imported/default_plant_glowing.png-1922303555901146cff9778bc5fe2dcb.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entities/interactables/plants/assets/sprites/default_plant_glowing.png"
|
source_file="res://entities/plants/assets/sprites/default_plant_glowing.png"
|
||||||
dest_files=["res://.godot/imported/default_plant_glowing.png-09ba534646a860193c36fa40d5f83142.ctex"]
|
dest_files=["res://.godot/imported/default_plant_glowing.png-1922303555901146cff9778bc5fe2dcb.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
[gd_resource type="Resource" script_class="DecontaminateTerrainEffect" load_steps=2 format=3 uid="uid://bdddlia6qxgf2"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://cgscbuxe4dawb" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="1_8l07v"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_8l07v")
|
||||||
|
impact_radius = 50
|
||||||
|
metadata/_custom_type_script = "uid://cgscbuxe4dawb"
|
||||||
21
entities/plants/resources/plants/default.tres
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
[gd_resource type="Resource" script_class="PlantType" load_steps=7 format=3 uid="uid://dmbu538b3utec"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://c7mp7tkkkk6o5" path="res://entities/plants/assets/sprites/default/growing.png" id="1_fp5j6"]
|
||||||
|
[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="1_moyj3"]
|
||||||
|
[ext_resource type="Script" uid="uid://cgscbuxe4dawb" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="2_cky1j"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bupl1y0cfj21q" path="res://entities/plants/assets/sprites/default/mature.png" id="3_ffarr"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://ba413oun7ry78" path="res://entities/plants/assets/sprites/default/planted.png" id="4_2s6re"]
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_q68uy"]
|
||||||
|
script = ExtResource("2_cky1j")
|
||||||
|
impact_radius = 100
|
||||||
|
metadata/_custom_type_script = "uid://cgscbuxe4dawb"
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_moyj3")
|
||||||
|
growing_time = 2
|
||||||
|
planted_texture = ExtResource("4_2s6re")
|
||||||
|
growing_texture = ExtResource("1_fp5j6")
|
||||||
|
mature_texture = ExtResource("3_ffarr")
|
||||||
|
mature_effect = SubResource("Resource_q68uy")
|
||||||
|
metadata/_custom_type_script = "uid://jnye5pe1bgqw"
|
||||||
66
entities/plants/scripts/plant.gd
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
extends Node2D
|
||||||
|
class_name Plant
|
||||||
|
|
||||||
|
const PLANT_AREA_WIDTH = 10
|
||||||
|
const PLANT_SPRITE_SCALE = 0.15
|
||||||
|
|
||||||
|
enum State {PLANTED, GROWING, MATURE}
|
||||||
|
|
||||||
|
var plant_type : PlantType
|
||||||
|
var planet : Planet
|
||||||
|
|
||||||
|
var state : State = State.PLANTED : set = change_state
|
||||||
|
var day : int = 0
|
||||||
|
|
||||||
|
@onready var plant_sprite : Sprite2D = generate_sprite()
|
||||||
|
@onready var plant_area : Area2D = generate_area()
|
||||||
|
|
||||||
|
func _init(_plant_type, _planet):
|
||||||
|
plant_type = _plant_type
|
||||||
|
planet = _planet
|
||||||
|
|
||||||
|
func generate_sprite() -> Sprite2D:
|
||||||
|
var sprite = Sprite2D.new()
|
||||||
|
|
||||||
|
add_child(sprite)
|
||||||
|
sprite.texture = get_state_texture(state)
|
||||||
|
sprite.scale = Vector2.ONE * PLANT_SPRITE_SCALE
|
||||||
|
sprite.offset
|
||||||
|
|
||||||
|
return sprite
|
||||||
|
|
||||||
|
func generate_area() -> Area2D:
|
||||||
|
var area = Area2D.new()
|
||||||
|
var collision = CollisionShape2D.new()
|
||||||
|
var collision_shape = CircleShape2D.new()
|
||||||
|
collision_shape.radius = PLANT_AREA_WIDTH
|
||||||
|
|
||||||
|
collision.shape = collision_shape
|
||||||
|
area.add_child(collision)
|
||||||
|
add_child(area)
|
||||||
|
|
||||||
|
return area
|
||||||
|
|
||||||
|
func pass_day():
|
||||||
|
day += 1
|
||||||
|
if day > plant_type.growing_time:
|
||||||
|
change_state(State.MATURE)
|
||||||
|
else:
|
||||||
|
change_state(State.GROWING)
|
||||||
|
|
||||||
|
func change_state(_state : State):
|
||||||
|
state = _state
|
||||||
|
plant_sprite.texture = get_state_texture(state)
|
||||||
|
|
||||||
|
if state == State.MATURE and plant_type.mature_effect:
|
||||||
|
plant_type.mature_effect.effect(self)
|
||||||
|
|
||||||
|
func get_state_texture(s : State) -> Texture2D:
|
||||||
|
match s:
|
||||||
|
State.PLANTED:
|
||||||
|
return plant_type.planted_texture
|
||||||
|
State.GROWING:
|
||||||
|
return plant_type.growing_texture
|
||||||
|
State.MATURE:
|
||||||
|
return plant_type.mature_texture
|
||||||
|
return null
|
||||||
7
entities/plants/scripts/plant_effect.gd
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Classe abstraite permettant de développer divers effets de plantes
|
||||||
|
extends Resource
|
||||||
|
class_name PlantEffect
|
||||||
|
|
||||||
|
func effect(plant):
|
||||||
|
printerr("Classe abstraite PlantEffect appelée")
|
||||||
|
|
||||||
1
entities/plants/scripts/plant_effect.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://bpycohqas4hff
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
extends PlantEffect
|
||||||
|
class_name DecontaminateTerrainEffect
|
||||||
|
|
||||||
|
@export var impact_radius = 50
|
||||||
|
|
||||||
|
func effect(plant):
|
||||||
|
plant.planet.impact_contamination(
|
||||||
|
plant.global_position,
|
||||||
|
impact_radius
|
||||||
|
)
|
||||||
@ -0,0 +1 @@
|
|||||||
|
uid://cgscbuxe4dawb
|
||||||
13
entities/plants/scripts/plant_type.gd
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends Resource
|
||||||
|
class_name PlantType
|
||||||
|
|
||||||
|
@export var name : String
|
||||||
|
|
||||||
|
@export var growing_time : int
|
||||||
|
|
||||||
|
@export var seed_texture : Texture
|
||||||
|
@export var planted_texture : Texture
|
||||||
|
@export var growing_texture : Texture
|
||||||
|
@export var mature_texture : Texture
|
||||||
|
|
||||||
|
@export var mature_effect : PlantEffect
|
||||||
1
entities/plants/scripts/plant_type.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://jnye5pe1bgqw
|
||||||
@ -1,7 +1,20 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://bgvbgeq46wee2"]
|
[gd_scene load_steps=22 format=3 uid="uid://bgvbgeq46wee2"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://das7twcy5153p" path="res://entities/player/scripts/player.gd" id="1_abrql"]
|
[ext_resource type="Script" uid="uid://das7twcy5153p" path="res://entities/player/scripts/player.gd" id="1_abrql"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c7ff87jniga5m" path="res://entities/player/assets/sprites/robot.png" id="1_symyc"]
|
[ext_resource type="Texture2D" uid="uid://c7ff87jniga5m" path="res://entities/player/assets/sprites/robot.png" id="1_symyc"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://dfrp66a4isnt6" path="res://entities/player/sounds/dig/dig_1.wav" id="3_gx6sm"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://bdxkvaciw4mb3" path="res://entities/player/sounds/dig/dig_2.wav" id="4_yqrof"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://llxrlwfccywb" path="res://entities/player/sounds/dig/dig_3.wav" id="5_3wlsy"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://6qmm1lmkft13" path="res://entities/player/sounds/harvest/harvest_1.wav" id="6_b2kln"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://cfwqjs2koxyi8" path="res://entities/player/sounds/harvest/harvest_2.wav" id="7_we0b7"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://xiif55xgsoxs" path="res://entities/player/sounds/harvest/harvest_3.wav" id="8_mtric"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://bc803023sso65" path="res://entities/player/sounds/harvest/harvest_4.wav" id="9_eyb6c"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://bv65uncyiu3dc" path="res://entities/player/sounds/harvest/harvest_5.wav" id="10_221hk"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://b0hxscxlo241f" path="res://entities/player/sounds/harvest/harvest_6.wav" id="11_ghoj8"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://bkitf5nhaa36p" path="res://entities/player/sounds/pick_up/pick_up_1.wav" id="12_t1t22"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://dx58x1sg61mrv" path="res://entities/player/sounds/pick_up/pick_up_2.wav" id="13_50fht"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://c0fw77uiiwnfb" path="res://entities/player/sounds/pick_up/pick_up_3.wav" id="14_wuv6x"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://b4sxly5jsvlkr" path="res://entities/player/sounds/movement/movement.wav" id="15_qpopc"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_sglur"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_sglur"]
|
||||||
radius = 27.0
|
radius = 27.0
|
||||||
@ -9,20 +22,63 @@ radius = 27.0
|
|||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_abrql"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_abrql"]
|
||||||
radius = 40.0
|
radius = 40.0
|
||||||
|
|
||||||
|
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_wq0jh"]
|
||||||
|
random_pitch = 1.5
|
||||||
|
streams_count = 3
|
||||||
|
stream_0/stream = ExtResource("3_gx6sm")
|
||||||
|
stream_1/stream = ExtResource("4_yqrof")
|
||||||
|
stream_2/stream = ExtResource("5_3wlsy")
|
||||||
|
|
||||||
|
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_gt4e4"]
|
||||||
|
random_pitch = 1.5
|
||||||
|
streams_count = 6
|
||||||
|
stream_0/stream = ExtResource("6_b2kln")
|
||||||
|
stream_1/stream = ExtResource("7_we0b7")
|
||||||
|
stream_2/stream = ExtResource("8_mtric")
|
||||||
|
stream_3/stream = ExtResource("9_eyb6c")
|
||||||
|
stream_4/stream = ExtResource("10_221hk")
|
||||||
|
stream_5/stream = ExtResource("11_ghoj8")
|
||||||
|
|
||||||
|
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_24ehl"]
|
||||||
|
random_pitch = 1.5
|
||||||
|
streams_count = 3
|
||||||
|
stream_0/stream = ExtResource("12_t1t22")
|
||||||
|
stream_1/stream = ExtResource("13_50fht")
|
||||||
|
stream_2/stream = ExtResource("14_wuv6x")
|
||||||
|
|
||||||
|
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_bwdx1"]
|
||||||
|
random_pitch = 1.5
|
||||||
|
streams_count = 1
|
||||||
|
stream_0/stream = ExtResource("15_qpopc")
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody2D"]
|
[node name="Player" type="CharacterBody2D"]
|
||||||
script = ExtResource("1_abrql")
|
script = ExtResource("1_abrql")
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite2D" parent="."]
|
[node name="Sprite" type="Sprite2D" parent="."]
|
||||||
position = Vector2(2, -20)
|
position = Vector2(2, -55)
|
||||||
scale = Vector2(0.084375, 0.084375)
|
scale = Vector2(0.084375, 0.084375)
|
||||||
texture = ExtResource("1_symyc")
|
texture = ExtResource("1_symyc")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(-2, 15)
|
position = Vector2(-2, -20)
|
||||||
shape = SubResource("CircleShape2D_sglur")
|
shape = SubResource("CircleShape2D_sglur")
|
||||||
|
|
||||||
[node name="InteractArea2D" type="Area2D" parent="."]
|
[node name="InteractArea2D" type="Area2D" parent="."]
|
||||||
position = Vector2(0, 21)
|
position = Vector2(0, -14)
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractArea2D"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractArea2D"]
|
||||||
shape = SubResource("CircleShape2D_abrql")
|
shape = SubResource("CircleShape2D_abrql")
|
||||||
|
|
||||||
|
[node name="Audio" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
[node name="AudioStreamPlayer_dig" type="AudioStreamPlayer" parent="Audio"]
|
||||||
|
stream = SubResource("AudioStreamRandomizer_wq0jh")
|
||||||
|
|
||||||
|
[node name="AudioStreamPlayer_harvest" type="AudioStreamPlayer" parent="Audio"]
|
||||||
|
stream = SubResource("AudioStreamRandomizer_gt4e4")
|
||||||
|
|
||||||
|
[node name="AudioStreamPlayer_pick_up" type="AudioStreamPlayer" parent="Audio"]
|
||||||
|
stream = SubResource("AudioStreamRandomizer_24ehl")
|
||||||
|
|
||||||
|
[node name="AudioStreamPlayer_movement" type="AudioStreamPlayer" parent="Audio"]
|
||||||
|
stream = SubResource("AudioStreamRandomizer_bwdx1")
|
||||||
|
|||||||
@ -1,24 +1,51 @@
|
|||||||
extends CharacterBody2D
|
extends CharacterBody2D
|
||||||
class_name Player
|
class_name Player
|
||||||
|
|
||||||
signal player_stats_updated(player : Player)
|
signal player_updated(player: Player)
|
||||||
|
|
||||||
var planet : Planet # mis à jour par la classe Planet
|
var planet : Planet # mis à jour par la classe Planet
|
||||||
@export var speed = 400
|
@export var speed = 400
|
||||||
|
|
||||||
var energy : int = 10 :
|
@export var testPlantType : PlantType
|
||||||
|
|
||||||
|
@onready var inventory : Inventory = Inventory.new()
|
||||||
|
|
||||||
|
var max_energy : int = 10
|
||||||
|
|
||||||
|
var controlling_player : bool = true :
|
||||||
|
set(v):
|
||||||
|
controlling_player = v
|
||||||
|
velocity = Vector2.ZERO
|
||||||
|
|
||||||
|
var closest_interactable : Interactable = null :
|
||||||
|
set(v):
|
||||||
|
var old = closest_interactable
|
||||||
|
closest_interactable = v
|
||||||
|
if old != closest_interactable:
|
||||||
|
player_updated.emit(self)
|
||||||
|
var energy : int = max_energy :
|
||||||
set(v):
|
set(v):
|
||||||
energy = v
|
energy = v
|
||||||
emit_signal("player_stats_updated", self)
|
emit_signal("player_updated", self)
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
emit_signal("player_stats_updated", self)
|
emit_signal("player_updated", self)
|
||||||
|
inventory.inventory_changed.connect(_on_inventory_updated)
|
||||||
|
|
||||||
|
func _on_inventory_updated(_inventory: Inventory):
|
||||||
|
emit_signal("player_updated", self)
|
||||||
|
|
||||||
func get_input():
|
func get_input():
|
||||||
|
if controlling_player:
|
||||||
calculate_direction()
|
calculate_direction()
|
||||||
|
|
||||||
if Input.is_action_just_pressed("interact") and energy > 0:
|
if Input.is_action_just_pressed("action") and energy > 0:
|
||||||
try_interact()
|
action()
|
||||||
|
if Input.is_action_just_pressed("interact") and closest_interactable:
|
||||||
|
closest_interactable.interact(self)
|
||||||
|
if Input.is_action_just_pressed("drop") and inventory.lenght() > 0:
|
||||||
|
var item_to_drop = inventory.pop_item()
|
||||||
|
planet.drop_item(item_to_drop, global_position)
|
||||||
|
|
||||||
func calculate_direction():
|
func calculate_direction():
|
||||||
var input_direction: Vector2 = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
var input_direction: Vector2 = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||||
@ -26,24 +53,42 @@ func calculate_direction():
|
|||||||
if input_direction.x:
|
if input_direction.x:
|
||||||
$Sprite.flip_h = (input_direction.x < 0)
|
$Sprite.flip_h = (input_direction.x < 0)
|
||||||
|
|
||||||
func try_interact():
|
func action():
|
||||||
var interactables : Array[Interactable]
|
if planet:
|
||||||
|
planet.plant(
|
||||||
for area2D in $InteractArea2D.get_overlapping_areas():
|
testPlantType,
|
||||||
if area2D is Interactable:
|
global_position
|
||||||
interactables.push_front(area2D)
|
|
||||||
|
|
||||||
if len(interactables):
|
|
||||||
if len(interactables) > 1:
|
|
||||||
# Sort them to the closer
|
|
||||||
interactables.sort_custom(
|
|
||||||
func (el1 : Interactable, el2 : Interactable):
|
|
||||||
return el1.global_position.distance_to(global_position) > el2.global_position.distance_to(global_position)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
interactables[0].interact(self)
|
func pass_day():
|
||||||
energy -= 1
|
energy = max_energy
|
||||||
|
|
||||||
func _physics_process(_delta):
|
func detect_closest_interactable():
|
||||||
|
var in_range_interactables : Array[Interactable] = []
|
||||||
|
for area in $InteractArea2D.get_overlapping_areas():
|
||||||
|
if area is Interactable and area.available:
|
||||||
|
in_range_interactables.append(area)
|
||||||
|
|
||||||
|
in_range_interactables.sort_custom(
|
||||||
|
func(a : Node2D, b : Node2D) :
|
||||||
|
return a.global_position.distance_to(global_position) > b.global_position.distance_to(global_position)
|
||||||
|
)
|
||||||
|
|
||||||
|
if len(in_range_interactables) > 0:
|
||||||
|
closest_interactable = in_range_interactables[0]
|
||||||
|
else :
|
||||||
|
closest_interactable = null
|
||||||
|
|
||||||
|
func _process(_delta):
|
||||||
get_input()
|
get_input()
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
detect_closest_interactable()
|
||||||
|
|
||||||
|
func _on_root_gui_day_pass_pressed():
|
||||||
|
controlling_player = false
|
||||||
|
|
||||||
|
func _on_root_gui_day_pass_finished():
|
||||||
|
controlling_player = true
|
||||||
|
|
||||||
|
func _on_root_gui_game_click():
|
||||||
|
action()
|
||||||
|
|||||||
@ -3,12 +3,12 @@
|
|||||||
importer="wav"
|
importer="wav"
|
||||||
type="AudioStreamWAV"
|
type="AudioStreamWAV"
|
||||||
uid="uid://dfrp66a4isnt6"
|
uid="uid://dfrp66a4isnt6"
|
||||||
path="res://.godot/imported/dig_1.wav-7ad072dab09b362a7e8becc6a8e9d649.sample"
|
path="res://.godot/imported/dig_1.wav-76555a8720a69a7ba42f82311d7beaf8.sample"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entities/player/sounds/dig_1.wav"
|
source_file="res://entities/player/sounds/dig/dig_1.wav"
|
||||||
dest_files=["res://.godot/imported/dig_1.wav-7ad072dab09b362a7e8becc6a8e9d649.sample"]
|
dest_files=["res://.godot/imported/dig_1.wav-76555a8720a69a7ba42f82311d7beaf8.sample"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@ -3,12 +3,12 @@
|
|||||||
importer="wav"
|
importer="wav"
|
||||||
type="AudioStreamWAV"
|
type="AudioStreamWAV"
|
||||||
uid="uid://bdxkvaciw4mb3"
|
uid="uid://bdxkvaciw4mb3"
|
||||||
path="res://.godot/imported/dig_2.wav-2f707145e043039106f8e3bee1ed8e77.sample"
|
path="res://.godot/imported/dig_2.wav-4085353199cf7c47c8a581183b92f4a4.sample"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entities/player/sounds/dig_2.wav"
|
source_file="res://entities/player/sounds/dig/dig_2.wav"
|
||||||
dest_files=["res://.godot/imported/dig_2.wav-2f707145e043039106f8e3bee1ed8e77.sample"]
|
dest_files=["res://.godot/imported/dig_2.wav-4085353199cf7c47c8a581183b92f4a4.sample"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@ -3,12 +3,12 @@
|
|||||||
importer="wav"
|
importer="wav"
|
||||||
type="AudioStreamWAV"
|
type="AudioStreamWAV"
|
||||||
uid="uid://llxrlwfccywb"
|
uid="uid://llxrlwfccywb"
|
||||||
path="res://.godot/imported/dig_3.wav-e440fc7357505855b3b56d72821d8a95.sample"
|
path="res://.godot/imported/dig_3.wav-0c0bb89a725edb73ca5a10e31a6cc9ce.sample"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entities/player/sounds/dig_3.wav"
|
source_file="res://entities/player/sounds/dig/dig_3.wav"
|
||||||
dest_files=["res://.godot/imported/dig_3.wav-e440fc7357505855b3b56d72821d8a95.sample"]
|
dest_files=["res://.godot/imported/dig_3.wav-0c0bb89a725edb73ca5a10e31a6cc9ce.sample"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@ -3,12 +3,12 @@
|
|||||||
importer="wav"
|
importer="wav"
|
||||||
type="AudioStreamWAV"
|
type="AudioStreamWAV"
|
||||||
uid="uid://6qmm1lmkft13"
|
uid="uid://6qmm1lmkft13"
|
||||||
path="res://.godot/imported/harvest_1.wav-ba207989e74395ee730e7c4943696c32.sample"
|
path="res://.godot/imported/harvest_1.wav-556288586fc74dbc9e6e114c8da94313.sample"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entities/player/sounds/harvest_1.wav"
|
source_file="res://entities/player/sounds/harvest/harvest_1.wav"
|
||||||
dest_files=["res://.godot/imported/harvest_1.wav-ba207989e74395ee730e7c4943696c32.sample"]
|
dest_files=["res://.godot/imported/harvest_1.wav-556288586fc74dbc9e6e114c8da94313.sample"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@ -3,12 +3,12 @@
|
|||||||
importer="wav"
|
importer="wav"
|
||||||
type="AudioStreamWAV"
|
type="AudioStreamWAV"
|
||||||
uid="uid://cfwqjs2koxyi8"
|
uid="uid://cfwqjs2koxyi8"
|
||||||
path="res://.godot/imported/harvest_2.wav-158fd873c16237044d07d7079edc5abf.sample"
|
path="res://.godot/imported/harvest_2.wav-725aa211bb996cf5e7c0f8044f1a0596.sample"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entities/player/sounds/harvest_2.wav"
|
source_file="res://entities/player/sounds/harvest/harvest_2.wav"
|
||||||
dest_files=["res://.godot/imported/harvest_2.wav-158fd873c16237044d07d7079edc5abf.sample"]
|
dest_files=["res://.godot/imported/harvest_2.wav-725aa211bb996cf5e7c0f8044f1a0596.sample"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@ -3,12 +3,12 @@
|
|||||||
importer="wav"
|
importer="wav"
|
||||||
type="AudioStreamWAV"
|
type="AudioStreamWAV"
|
||||||
uid="uid://xiif55xgsoxs"
|
uid="uid://xiif55xgsoxs"
|
||||||
path="res://.godot/imported/harvest_3.wav-ba1f76ac9d83e08f35513c7dbeb090f5.sample"
|
path="res://.godot/imported/harvest_3.wav-311bb1444da6f3ce34003b61b417f328.sample"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entities/player/sounds/harvest_3.wav"
|
source_file="res://entities/player/sounds/harvest/harvest_3.wav"
|
||||||
dest_files=["res://.godot/imported/harvest_3.wav-ba1f76ac9d83e08f35513c7dbeb090f5.sample"]
|
dest_files=["res://.godot/imported/harvest_3.wav-311bb1444da6f3ce34003b61b417f328.sample"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@ -3,12 +3,12 @@
|
|||||||
importer="wav"
|
importer="wav"
|
||||||
type="AudioStreamWAV"
|
type="AudioStreamWAV"
|
||||||
uid="uid://bc803023sso65"
|
uid="uid://bc803023sso65"
|
||||||
path="res://.godot/imported/harvest_4.wav-35e3d63c56e7a1d73bee6cc87ace3be8.sample"
|
path="res://.godot/imported/harvest_4.wav-7e79f33b699be1fa97bd3397f39b13b8.sample"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entities/player/sounds/harvest_4.wav"
|
source_file="res://entities/player/sounds/harvest/harvest_4.wav"
|
||||||
dest_files=["res://.godot/imported/harvest_4.wav-35e3d63c56e7a1d73bee6cc87ace3be8.sample"]
|
dest_files=["res://.godot/imported/harvest_4.wav-7e79f33b699be1fa97bd3397f39b13b8.sample"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@ -3,12 +3,12 @@
|
|||||||
importer="wav"
|
importer="wav"
|
||||||
type="AudioStreamWAV"
|
type="AudioStreamWAV"
|
||||||
uid="uid://bv65uncyiu3dc"
|
uid="uid://bv65uncyiu3dc"
|
||||||
path="res://.godot/imported/harvest_5.wav-2a7c17a378f34ee56ecf2d841af1dcf5.sample"
|
path="res://.godot/imported/harvest_5.wav-39f01e30ca86bf5c233491f011175058.sample"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entities/player/sounds/harvest_5.wav"
|
source_file="res://entities/player/sounds/harvest/harvest_5.wav"
|
||||||
dest_files=["res://.godot/imported/harvest_5.wav-2a7c17a378f34ee56ecf2d841af1dcf5.sample"]
|
dest_files=["res://.godot/imported/harvest_5.wav-39f01e30ca86bf5c233491f011175058.sample"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@ -3,12 +3,12 @@
|
|||||||
importer="wav"
|
importer="wav"
|
||||||
type="AudioStreamWAV"
|
type="AudioStreamWAV"
|
||||||
uid="uid://b0hxscxlo241f"
|
uid="uid://b0hxscxlo241f"
|
||||||
path="res://.godot/imported/harvest_6.wav-2836dc15776824ff43e7c447a4e48c92.sample"
|
path="res://.godot/imported/harvest_6.wav-2e0a40cb05e9420a9f46463c9b5ddae3.sample"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entities/player/sounds/harvest_6.wav"
|
source_file="res://entities/player/sounds/harvest/harvest_6.wav"
|
||||||
dest_files=["res://.godot/imported/harvest_6.wav-2836dc15776824ff43e7c447a4e48c92.sample"]
|
dest_files=["res://.godot/imported/harvest_6.wav-2e0a40cb05e9420a9f46463c9b5ddae3.sample"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
BIN
entities/player/sounds/movement/movement.wav
Normal file
24
entities/player/sounds/movement/movement.wav.import
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamWAV"
|
||||||
|
uid="uid://b4sxly5jsvlkr"
|
||||||
|
path="res://.godot/imported/movement.wav-eff57eb45a7ca8b1e138ffe135ccf98e.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://entities/player/sounds/movement/movement.wav"
|
||||||
|
dest_files=["res://.godot/imported/movement.wav-eff57eb45a7ca8b1e138ffe135ccf98e.sample"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
force/8_bit=false
|
||||||
|
force/mono=false
|
||||||
|
force/max_rate=false
|
||||||
|
force/max_rate_hz=44100
|
||||||
|
edit/trim=false
|
||||||
|
edit/normalize=false
|
||||||
|
edit/loop_mode=0
|
||||||
|
edit/loop_begin=0
|
||||||
|
edit/loop_end=-1
|
||||||
|
compress/mode=2
|
||||||
@ -3,12 +3,12 @@
|
|||||||
importer="wav"
|
importer="wav"
|
||||||
type="AudioStreamWAV"
|
type="AudioStreamWAV"
|
||||||
uid="uid://bkitf5nhaa36p"
|
uid="uid://bkitf5nhaa36p"
|
||||||
path="res://.godot/imported/pick_up_1.wav-35d486c68a4148d6f225129804209371.sample"
|
path="res://.godot/imported/pick_up_1.wav-0e258b69af06c5691f2997179a1bf36b.sample"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entities/player/sounds/pick_up_1.wav"
|
source_file="res://entities/player/sounds/pick_up/pick_up_1.wav"
|
||||||
dest_files=["res://.godot/imported/pick_up_1.wav-35d486c68a4148d6f225129804209371.sample"]
|
dest_files=["res://.godot/imported/pick_up_1.wav-0e258b69af06c5691f2997179a1bf36b.sample"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@ -3,12 +3,12 @@
|
|||||||
importer="wav"
|
importer="wav"
|
||||||
type="AudioStreamWAV"
|
type="AudioStreamWAV"
|
||||||
uid="uid://dx58x1sg61mrv"
|
uid="uid://dx58x1sg61mrv"
|
||||||
path="res://.godot/imported/pick_up_2.wav-8b13148dd5bc8870c5578d85f90542eb.sample"
|
path="res://.godot/imported/pick_up_2.wav-ccfd626b41684f4735889c5b2d905e6f.sample"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entities/player/sounds/pick_up_2.wav"
|
source_file="res://entities/player/sounds/pick_up/pick_up_2.wav"
|
||||||
dest_files=["res://.godot/imported/pick_up_2.wav-8b13148dd5bc8870c5578d85f90542eb.sample"]
|
dest_files=["res://.godot/imported/pick_up_2.wav-ccfd626b41684f4735889c5b2d905e6f.sample"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@ -3,12 +3,12 @@
|
|||||||
importer="wav"
|
importer="wav"
|
||||||
type="AudioStreamWAV"
|
type="AudioStreamWAV"
|
||||||
uid="uid://c0fw77uiiwnfb"
|
uid="uid://c0fw77uiiwnfb"
|
||||||
path="res://.godot/imported/pick_up_3.wav-4925e1a793c7954804fab43c81d2df3e.sample"
|
path="res://.godot/imported/pick_up_3.wav-1c884c9c43e4320c0a87534d4376e4e0.sample"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entities/player/sounds/pick_up_3.wav"
|
source_file="res://entities/player/sounds/pick_up/pick_up_3.wav"
|
||||||
dest_files=["res://.godot/imported/pick_up_3.wav-4925e1a793c7954804fab43c81d2df3e.sample"]
|
dest_files=["res://.godot/imported/pick_up_3.wav-1c884c9c43e4320c0a87534d4376e4e0.sample"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
BIN
gui/assets/texture/Tablette info.png
Normal file
|
After Width: | Height: | Size: 285 KiB |
34
gui/assets/texture/Tablette info.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://c2pgaklnj5w3d"
|
||||||
|
path="res://.godot/imported/Tablette info.png-0d02a3ea4c574d196b3e778477072d61.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://gui/assets/texture/Tablette info.png"
|
||||||
|
dest_files=["res://.godot/imported/Tablette info.png-0d02a3ea4c574d196b3e778477072d61.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
@ -3,11 +3,8 @@
|
|||||||
[ext_resource type="Script" uid="uid://bpqh8n0lbluf8" path="res://gui/player_info/scripts/player_info.gd" id="1_ghu0s"]
|
[ext_resource type="Script" uid="uid://bpqh8n0lbluf8" path="res://gui/player_info/scripts/player_info.gd" id="1_ghu0s"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cm3ehinvvj52i" path="res://gui/player_info/assets/texture/Interface sans boutons.png" id="2_cgy6f"]
|
[ext_resource type="Texture2D" uid="uid://cm3ehinvvj52i" path="res://gui/player_info/assets/texture/Interface sans boutons.png" id="2_cgy6f"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://gui/player_info/assets/icons/bolt.svg" id="3_s4ggy"]
|
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://gui/player_info/assets/icons/bolt.svg" id="3_s4ggy"]
|
||||||
[ext_resource type="FontFile" uid="uid://byyfovm1ha5ya" path="res://gui/ressources/fonts/AtomicMd-3zXDZ.ttf" id="4_5y5ny"]
|
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="4_cgy6f"]
|
||||||
|
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/default_label_settings.tres" id="5_s4ggy"]
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_bye71"]
|
|
||||||
font = ExtResource("4_5y5ny")
|
|
||||||
font_size = 25
|
|
||||||
|
|
||||||
[node name="PlayerInfo" type="Control"]
|
[node name="PlayerInfo" type="Control"]
|
||||||
custom_minimum_size = Vector2(337, 160)
|
custom_minimum_size = Vector2(337, 160)
|
||||||
@ -56,7 +53,16 @@ stretch_mode = 5
|
|||||||
|
|
||||||
[node name="Label" type="Label" parent="EnergyInfo"]
|
[node name="Label" type="Label" parent="EnergyInfo"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
theme = ExtResource("4_cgy6f")
|
||||||
text = "0"
|
text = "0"
|
||||||
label_settings = SubResource("LabelSettings_bye71")
|
label_settings = ExtResource("5_s4ggy")
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="Inventory" type="HBoxContainer" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 157.0
|
||||||
|
offset_top = 86.0
|
||||||
|
offset_right = 291.0
|
||||||
|
offset_bottom = 126.0
|
||||||
|
alignment = 1
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
func _on_root_gui_player_stats_updated(player:Player):
|
func player_update(player: Player):
|
||||||
$EnergyInfo/Label.text = str(player.energy)
|
$EnergyInfo/Label.text = str(player.energy)
|
||||||
|
|||||||
BIN
gui/ressources/Tablette info.png
Normal file
|
After Width: | Height: | Size: 285 KiB |
34
gui/ressources/Tablette info.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://qx75h1k3wmm1"
|
||||||
|
path="res://.godot/imported/Tablette info.png-e89cd3fdb4a303341f3bbad730de279c.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://gui/ressources/Tablette info.png"
|
||||||
|
dest_files=["res://.godot/imported/Tablette info.png-e89cd3fdb4a303341f3bbad730de279c.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
7
gui/ressources/default_label_settings.tres
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[gd_resource type="LabelSettings" load_steps=2 format=3 uid="uid://dqwayi8yjwau2"]
|
||||||
|
|
||||||
|
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="1_w0wva"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
font = ExtResource("1_w0wva")
|
||||||
|
font_size = 25
|
||||||
51
gui/ressources/default_theme.tres
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
[gd_resource type="Theme" load_steps=5 format=3 uid="uid://bgcmd213j6gk1"]
|
||||||
|
|
||||||
|
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="1_hv6r3"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_hv6r3"]
|
||||||
|
bg_color = Color(0.976471, 0.741176, 0.4, 1)
|
||||||
|
border_width_left = 10
|
||||||
|
border_width_top = 10
|
||||||
|
border_width_right = 10
|
||||||
|
border_width_bottom = 10
|
||||||
|
border_color = Color(0.975367, 0.740445, 0.401877, 1)
|
||||||
|
corner_radius_top_left = 5
|
||||||
|
corner_radius_top_right = 5
|
||||||
|
corner_radius_bottom_right = 5
|
||||||
|
corner_radius_bottom_left = 5
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_y48f0"]
|
||||||
|
bg_color = Color(0.886275, 0.623529, 0.196078, 1)
|
||||||
|
border_width_left = 10
|
||||||
|
border_width_top = 10
|
||||||
|
border_width_right = 10
|
||||||
|
border_width_bottom = 10
|
||||||
|
border_color = Color(0.886275, 0.623529, 0.196078, 1)
|
||||||
|
corner_radius_top_left = 5
|
||||||
|
corner_radius_top_right = 5
|
||||||
|
corner_radius_bottom_right = 5
|
||||||
|
corner_radius_bottom_left = 5
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_st1o2"]
|
||||||
|
bg_color = Color(0.692349, 0.477218, 0.112321, 1)
|
||||||
|
border_width_left = 10
|
||||||
|
border_width_top = 10
|
||||||
|
border_width_right = 10
|
||||||
|
border_width_bottom = 10
|
||||||
|
border_color = Color(0.694118, 0.478431, 0.113725, 1)
|
||||||
|
corner_radius_top_left = 5
|
||||||
|
corner_radius_top_right = 5
|
||||||
|
corner_radius_bottom_right = 5
|
||||||
|
corner_radius_bottom_left = 5
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
Button/font_sizes/font_size = 25
|
||||||
|
Button/fonts/font = ExtResource("1_hv6r3")
|
||||||
|
Button/styles/hover = SubResource("StyleBoxFlat_hv6r3")
|
||||||
|
Button/styles/normal = SubResource("StyleBoxFlat_y48f0")
|
||||||
|
Button/styles/pressed = SubResource("StyleBoxFlat_st1o2")
|
||||||
|
HBoxContainer/constants/separation = 15
|
||||||
|
MarginContainer/constants/margin_bottom = 15
|
||||||
|
MarginContainer/constants/margin_left = 15
|
||||||
|
MarginContainer/constants/margin_right = 15
|
||||||
|
MarginContainer/constants/margin_top = 15
|
||||||
BIN
gui/ressources/fonts/spincycle_3d_ot.otf
Normal file
35
gui/ressources/fonts/spincycle_3d_ot.otf.import
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="font_data_dynamic"
|
||||||
|
type="FontFile"
|
||||||
|
uid="uid://c8xf3tfnpufk3"
|
||||||
|
path="res://.godot/imported/spincycle_3d_ot.otf-f71d33fbaded9da2ba85d0eb20bfd1e1.fontdata"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://gui/ressources/fonts/spincycle_3d_ot.otf"
|
||||||
|
dest_files=["res://.godot/imported/spincycle_3d_ot.otf-f71d33fbaded9da2ba85d0eb20bfd1e1.fontdata"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
Rendering=null
|
||||||
|
antialiasing=1
|
||||||
|
generate_mipmaps=false
|
||||||
|
disable_embedded_bitmaps=true
|
||||||
|
multichannel_signed_distance_field=false
|
||||||
|
msdf_pixel_range=8
|
||||||
|
msdf_size=48
|
||||||
|
allow_system_fallback=true
|
||||||
|
force_autohinter=false
|
||||||
|
hinting=1
|
||||||
|
subpixel_positioning=4
|
||||||
|
keep_rounding_remainders=true
|
||||||
|
oversampling=0.0
|
||||||
|
Fallbacks=null
|
||||||
|
fallbacks=[]
|
||||||
|
Compress=null
|
||||||
|
compress=true
|
||||||
|
preload=[]
|
||||||
|
language_support={}
|
||||||
|
script_support={}
|
||||||
|
opentype_features={}
|
||||||
BIN
gui/ressources/fonts/spincycle_ot.otf
Normal file
35
gui/ressources/fonts/spincycle_ot.otf.import
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="font_data_dynamic"
|
||||||
|
type="FontFile"
|
||||||
|
uid="uid://cpnsnrqhfkj3k"
|
||||||
|
path="res://.godot/imported/spincycle_ot.otf-be21809daa8fde21c00f1cf664ce2342.fontdata"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://gui/ressources/fonts/spincycle_ot.otf"
|
||||||
|
dest_files=["res://.godot/imported/spincycle_ot.otf-be21809daa8fde21c00f1cf664ce2342.fontdata"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
Rendering=null
|
||||||
|
antialiasing=1
|
||||||
|
generate_mipmaps=false
|
||||||
|
disable_embedded_bitmaps=true
|
||||||
|
multichannel_signed_distance_field=false
|
||||||
|
msdf_pixel_range=8
|
||||||
|
msdf_size=48
|
||||||
|
allow_system_fallback=true
|
||||||
|
force_autohinter=false
|
||||||
|
hinting=1
|
||||||
|
subpixel_positioning=4
|
||||||
|
keep_rounding_remainders=true
|
||||||
|
oversampling=0.0
|
||||||
|
Fallbacks=null
|
||||||
|
fallbacks=[]
|
||||||
|
Compress=null
|
||||||
|
compress=true
|
||||||
|
preload=[]
|
||||||
|
language_support={}
|
||||||
|
script_support={}
|
||||||
|
opentype_features={}
|
||||||
@ -1,7 +1,105 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://12nak7amd1uq"]
|
[gd_scene load_steps=14 format=3 uid="uid://12nak7amd1uq"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://baqrmhsgqda6v" path="res://gui/player_info/player_info.tscn" id="1_8kw6x"]
|
[ext_resource type="PackedScene" uid="uid://baqrmhsgqda6v" path="res://gui/player_info/player_info.tscn" id="1_8kw6x"]
|
||||||
[ext_resource type="Script" uid="uid://cqao7n800qy40" path="res://gui/scripts/root_gui.gd" id="1_udau0"]
|
[ext_resource type="Script" uid="uid://cqao7n800qy40" path="res://gui/scripts/root_gui.gd" id="1_udau0"]
|
||||||
|
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="2_nq5i2"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://gui/player_info/assets/icons/bolt.svg" id="4_k4juk"]
|
||||||
|
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/default_label_settings.tres" id="4_ujg5r"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://c2pgaklnj5w3d" path="res://gui/assets/texture/Tablette info.png" id="6_fovlv"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bf6nw4onkhavr" path="res://common/inventory/assets/icons/shovel.svg" id="7_n4kem"]
|
||||||
|
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="8_n4kem"]
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_ek73b"]
|
||||||
|
font = ExtResource("8_n4kem")
|
||||||
|
font_size = 20
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_iyvkh"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("RechargeFade:color")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(0, 0, 0, 0)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("RechargeFade:visible")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_k4juk"]
|
||||||
|
resource_name = "recharge_fade_in"
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("RechargeFade:color")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(0, 0, 0, 0), Color(0, 0, 0, 1)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("RechargeFade:visible")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [true]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_fovlv"]
|
||||||
|
resource_name = "recharge_fade_out"
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("RechargeFade:color")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0.166667, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 0)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("RechargeFade:visible")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(1),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_n4kem"]
|
||||||
|
_data = {
|
||||||
|
&"RESET": SubResource("Animation_iyvkh"),
|
||||||
|
&"recharge_fade_in": SubResource("Animation_k4juk"),
|
||||||
|
&"recharge_fade_out": SubResource("Animation_fovlv")
|
||||||
|
}
|
||||||
|
|
||||||
[node name="RootGui" type="Control"]
|
[node name="RootGui" type="Control"]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
@ -14,14 +112,143 @@ size_flags_horizontal = 3
|
|||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
script = ExtResource("1_udau0")
|
script = ExtResource("1_udau0")
|
||||||
|
|
||||||
[node name="PlayerInfo" parent="." instance=ExtResource("1_8kw6x")]
|
[node name="GameAction" type="TextureButton" parent="."]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 0
|
anchors_preset = 15
|
||||||
anchor_right = 0.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 1.0
|
||||||
offset_right = 337.0
|
grow_horizontal = 2
|
||||||
offset_bottom = 160.0
|
grow_vertical = 2
|
||||||
grow_horizontal = 1
|
|
||||||
grow_vertical = 1
|
|
||||||
|
|
||||||
[connection signal="player_stats_updated" from="." to="PlayerInfo" method="_on_root_gui_player_stats_updated"]
|
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
mouse_filter = 2
|
||||||
|
theme = ExtResource("2_nq5i2")
|
||||||
|
|
||||||
|
[node name="PlayerInfo" parent="MarginContainer" instance=ExtResource("1_8kw6x")]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="DayPass" type="Button" parent="MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 8
|
||||||
|
size_flags_vertical = 8
|
||||||
|
focus_mode = 0
|
||||||
|
theme = ExtResource("2_nq5i2")
|
||||||
|
text = "Recharge"
|
||||||
|
icon = ExtResource("4_k4juk")
|
||||||
|
|
||||||
|
[node name="DayCount" type="Label" parent="MarginContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 8
|
||||||
|
size_flags_vertical = 0
|
||||||
|
label_settings = ExtResource("4_ujg5r")
|
||||||
|
|
||||||
|
[node name="ItemInfo" type="TextureRect" parent="MarginContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(0, 300)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 0
|
||||||
|
size_flags_vertical = 8
|
||||||
|
theme = ExtResource("2_nq5i2")
|
||||||
|
texture = ExtResource("6_fovlv")
|
||||||
|
expand_mode = 3
|
||||||
|
stretch_mode = 4
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/ItemInfo"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/margin_left = 35
|
||||||
|
theme_override_constants/margin_top = 35
|
||||||
|
theme_override_constants/margin_right = 20
|
||||||
|
theme_override_constants/margin_bottom = 75
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/ItemInfo/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("2_nq5i2")
|
||||||
|
|
||||||
|
[node name="ItemIcon" type="TextureRect" parent="MarginContainer/ItemInfo/MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(0, 50)
|
||||||
|
layout_mode = 2
|
||||||
|
texture = ExtResource("7_n4kem")
|
||||||
|
stretch_mode = 3
|
||||||
|
|
||||||
|
[node name="ItemName" type="Label" parent="MarginContainer/ItemInfo/MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "fdqsd"
|
||||||
|
label_settings = SubResource("LabelSettings_ek73b")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="ItemDesc" type="Label" parent="MarginContainer/ItemInfo/MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 3
|
||||||
|
text = "Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. "
|
||||||
|
autowrap_mode = 3
|
||||||
|
clip_text = true
|
||||||
|
|
||||||
|
[node name="AvailableActions" type="HBoxContainer" parent="MarginContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 8
|
||||||
|
theme = ExtResource("2_nq5i2")
|
||||||
|
|
||||||
|
[node name="GetItem" type="Label" parent="MarginContainer/AvailableActions"]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
text = "E - Take Item"
|
||||||
|
label_settings = ExtResource("4_ujg5r")
|
||||||
|
|
||||||
|
[node name="SwapItem" type="Label" parent="MarginContainer/AvailableActions"]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
text = "E - Swap Item"
|
||||||
|
label_settings = ExtResource("4_ujg5r")
|
||||||
|
|
||||||
|
[node name="DropItem" type="Label" parent="MarginContainer/AvailableActions"]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
text = "w - Drop Item"
|
||||||
|
label_settings = ExtResource("4_ujg5r")
|
||||||
|
|
||||||
|
[node name="UseItem" type="Label" parent="MarginContainer/AvailableActions"]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
text = "space/click - Use Item"
|
||||||
|
label_settings = ExtResource("4_ujg5r")
|
||||||
|
|
||||||
|
[node name="RechargeFade" type="ColorRect" parent="."]
|
||||||
|
physics_interpolation_mode = 0
|
||||||
|
visible = false
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
color = Color(0, 0, 0, 0)
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
&"": SubResource("AnimationLibrary_n4kem")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="GridContainer" type="GridContainer" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_right = 40.0
|
||||||
|
offset_bottom = 40.0
|
||||||
|
|
||||||
|
[connection signal="button_down" from="GameAction" to="." method="_on_game_action_button_down"]
|
||||||
|
[connection signal="pressed" from="MarginContainer/DayPass" to="." method="_on_day_pass_pressed"]
|
||||||
|
|||||||
@ -1,7 +1,36 @@
|
|||||||
extends Control
|
extends Control
|
||||||
class_name RootGui
|
class_name RootGui
|
||||||
|
|
||||||
signal player_stats_updated(player : Player)
|
signal game_click
|
||||||
|
signal day_pass_pressed
|
||||||
|
signal day_pass_proceed
|
||||||
|
signal day_pass_finished
|
||||||
|
|
||||||
func _on_player_player_stats_updated(player:Player):
|
func _on_player_updated(player:Player):
|
||||||
emit_signal("player_stats_updated", player)
|
$MarginContainer/PlayerInfo.player_update(player)
|
||||||
|
|
||||||
|
%AvailableActions/GetItem.visible = player.closest_interactable is ItemObject and player.inventory.lenght() == 0
|
||||||
|
%AvailableActions/SwapItem.visible = player.closest_interactable is ItemObject and player.inventory.lenght() > 0
|
||||||
|
%AvailableActions/DropItem.visible = player.inventory.lenght() > 0
|
||||||
|
|
||||||
|
%ItemInfo.visible = player.inventory.lenght() > 0
|
||||||
|
if player.inventory.lenght() > 0:
|
||||||
|
var item : Item = player.inventory.get_item()
|
||||||
|
%ItemIcon.texture = item.icon
|
||||||
|
%ItemName.text = item.name
|
||||||
|
%ItemDesc.text = item.description
|
||||||
|
|
||||||
|
func _on_planet_planet_stats_updated(day:int):
|
||||||
|
$MarginContainer/DayCount.text = "Day " + str(day)
|
||||||
|
|
||||||
|
func _on_day_pass_pressed():
|
||||||
|
day_pass_pressed.emit()
|
||||||
|
$AnimationPlayer.play("recharge_fade_in")
|
||||||
|
await $AnimationPlayer.animation_finished
|
||||||
|
day_pass_proceed.emit()
|
||||||
|
$AnimationPlayer.play("recharge_fade_out")
|
||||||
|
await $AnimationPlayer.animation_finished
|
||||||
|
day_pass_finished.emit()
|
||||||
|
|
||||||
|
func _on_game_action_button_down():
|
||||||
|
game_click.emit()
|
||||||
|
|||||||
@ -43,7 +43,17 @@ move_down={
|
|||||||
}
|
}
|
||||||
interact={
|
interact={
|
||||||
"deadzone": 0.2,
|
"deadzone": 0.2,
|
||||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(222, 14),"global_position":Vector2(231, 62),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
action={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
drop={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":90,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
76
root.tscn
@ -1,10 +1,35 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://c5bruelvqbm1k"]
|
[gd_scene load_steps=9 format=3 uid="uid://c5bruelvqbm1k"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://12nak7amd1uq" path="res://gui/root_gui.tscn" id="1_jnlp7"]
|
[ext_resource type="PackedScene" uid="uid://12nak7amd1uq" path="res://gui/root_gui.tscn" id="1_jnlp7"]
|
||||||
[ext_resource type="PackedScene" uid="uid://tsi5j1uxppa4" path="res://stages/terrain/planet/planet.tscn" id="1_pyidc"]
|
[ext_resource type="PackedScene" uid="uid://tsi5j1uxppa4" path="res://stages/terrain/planet/planet.tscn" id="1_pyidc"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bgvbgeq46wee2" path="res://entities/player/player.tscn" id="2_vvh5c"]
|
[ext_resource type="PackedScene" uid="uid://bgvbgeq46wee2" path="res://entities/player/player.tscn" id="2_vvh5c"]
|
||||||
|
[ext_resource type="Resource" uid="uid://dmbu538b3utec" path="res://entities/plants/resources/plants/default.tres" id="3_jnlp7"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dj7gp3crtg2yt" path="res://entities/camera/camera.tscn" id="3_vvh5c"]
|
[ext_resource type="PackedScene" uid="uid://dj7gp3crtg2yt" path="res://entities/camera/camera.tscn" id="3_vvh5c"]
|
||||||
[ext_resource type="PackedScene" uid="uid://clpcqkdlj3d8e" path="res://entities/interactables/plants/default_plant.tscn" id="4_28aoi"]
|
[ext_resource type="PackedScene" uid="uid://cd3re3552pt7m" path="res://entities/interactables/item_object/item_object.tscn" id="4_vyht1"]
|
||||||
|
[ext_resource type="Resource" uid="uid://bb8etgye1qtfx" path="res://common/inventory/resources/items/shovel.tres" id="5_bf3um"]
|
||||||
|
[ext_resource type="Resource" uid="uid://dbja8xm7ehw1v" path="res://common/inventory/resources/items/water_can.tres" id="6_bf3um"]
|
||||||
|
|
||||||
|
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_8pgb7"]
|
||||||
|
random_pitch = 1.5
|
||||||
|
streams_count = 6
|
||||||
|
stream_0/stream = ExtResource("6_50g4q")
|
||||||
|
stream_1/stream = ExtResource("7_3dlgs")
|
||||||
|
stream_2/stream = ExtResource("8_vte5o")
|
||||||
|
stream_3/stream = ExtResource("9_po8fv")
|
||||||
|
stream_4/stream = ExtResource("10_ub8w1")
|
||||||
|
stream_5/stream = ExtResource("11_ynlg5")
|
||||||
|
|
||||||
|
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_tilu5"]
|
||||||
|
random_pitch = 1.5
|
||||||
|
streams_count = 3
|
||||||
|
stream_0/stream = ExtResource("12_ab83r")
|
||||||
|
stream_1/stream = ExtResource("13_1xb4a")
|
||||||
|
stream_2/stream = ExtResource("14_0dnjj")
|
||||||
|
|
||||||
|
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_24xe2"]
|
||||||
|
random_pitch = 1.5
|
||||||
|
streams_count = 1
|
||||||
|
stream_0/stream = ExtResource("15_uwexw")
|
||||||
|
|
||||||
[node name="Root" type="Node2D"]
|
[node name="Root" type="Node2D"]
|
||||||
|
|
||||||
@ -16,42 +41,31 @@
|
|||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
|
|
||||||
[node name="Player" parent="Entities" instance=ExtResource("2_vvh5c")]
|
[node name="Player" parent="Entities" instance=ExtResource("2_vvh5c")]
|
||||||
|
testPlantType = ExtResource("3_jnlp7")
|
||||||
|
|
||||||
[node name="DefaultPlant" parent="Entities" instance=ExtResource("4_28aoi")]
|
[node name="Shovel" parent="Entities" instance=ExtResource("4_vyht1")]
|
||||||
position = Vector2(195, 37)
|
position = Vector2(172, -31)
|
||||||
|
item = ExtResource("5_bf3um")
|
||||||
|
|
||||||
[node name="DefaultPlant2" parent="Entities" instance=ExtResource("4_28aoi")]
|
[node name="WaterCan" parent="Entities" instance=ExtResource("4_vyht1")]
|
||||||
position = Vector2(114, -40)
|
position = Vector2(-250, -116)
|
||||||
|
item = ExtResource("6_bf3um")
|
||||||
[node name="DefaultPlant3" parent="Entities" instance=ExtResource("4_28aoi")]
|
|
||||||
position = Vector2(-222, 138)
|
|
||||||
|
|
||||||
[node name="DefaultPlant4" parent="Entities" instance=ExtResource("4_28aoi")]
|
|
||||||
position = Vector2(-186, -96)
|
|
||||||
|
|
||||||
[node name="DefaultPlant5" parent="Entities" instance=ExtResource("4_28aoi")]
|
|
||||||
position = Vector2(-7, 150)
|
|
||||||
|
|
||||||
[node name="DefaultPlant6" parent="Entities" instance=ExtResource("4_28aoi")]
|
|
||||||
position = Vector2(-19, -102)
|
|
||||||
|
|
||||||
[node name="DefaultPlant7" parent="Entities" instance=ExtResource("4_28aoi")]
|
|
||||||
position = Vector2(-115, 50)
|
|
||||||
|
|
||||||
[node name="DefaultPlant8" parent="Entities" instance=ExtResource("4_28aoi")]
|
|
||||||
position = Vector2(147, -173)
|
|
||||||
|
|
||||||
[node name="DefaultPlant9" parent="Entities" instance=ExtResource("4_28aoi")]
|
|
||||||
position = Vector2(98, 90)
|
|
||||||
|
|
||||||
[node name="DefaultPlant10" parent="Entities" instance=ExtResource("4_28aoi")]
|
|
||||||
position = Vector2(-269, 1)
|
|
||||||
|
|
||||||
[node name="Planet" parent="." node_paths=PackedStringArray("import_entities_from_node") instance=ExtResource("1_pyidc")]
|
[node name="Planet" parent="." node_paths=PackedStringArray("import_entities_from_node") instance=ExtResource("1_pyidc")]
|
||||||
import_entities_from_node = NodePath("../Entities")
|
import_entities_from_node = NodePath("../Entities")
|
||||||
|
|
||||||
|
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="Planet"]
|
||||||
|
stream = ExtResource("5_l8v81")
|
||||||
|
volume_db = -4.0
|
||||||
|
autoplay = true
|
||||||
|
|
||||||
[node name="Camera" parent="." node_paths=PackedStringArray("following") instance=ExtResource("3_vvh5c")]
|
[node name="Camera" parent="." node_paths=PackedStringArray("following") instance=ExtResource("3_vvh5c")]
|
||||||
position = Vector2(2.22, 0)
|
position = Vector2(2.22, 0)
|
||||||
following = NodePath("../Entities/Player")
|
following = NodePath("../Entities/Player")
|
||||||
|
|
||||||
[connection signal="player_stats_updated" from="Entities/Player" to="CanvasLayer/RootGui" method="_on_player_player_stats_updated"]
|
[connection signal="day_pass_finished" from="CanvasLayer/RootGui" to="Entities/Player" method="_on_root_gui_day_pass_finished"]
|
||||||
|
[connection signal="day_pass_pressed" from="CanvasLayer/RootGui" to="Entities/Player" method="_on_root_gui_day_pass_pressed"]
|
||||||
|
[connection signal="day_pass_proceed" from="CanvasLayer/RootGui" to="Planet" method="_on_root_gui_day_pass_proceed"]
|
||||||
|
[connection signal="game_click" from="CanvasLayer/RootGui" to="Entities/Player" method="_on_root_gui_game_click"]
|
||||||
|
[connection signal="player_updated" from="Entities/Player" to="CanvasLayer/RootGui" method="_on_player_updated"]
|
||||||
|
[connection signal="planet_stats_updated" from="Planet" to="CanvasLayer/RootGui" method="_on_planet_planet_stats_updated"]
|
||||||
|
|||||||
BIN
stages/terrain/planet/music/fin_de_cycle_phase_1.ogg
Normal file
19
stages/terrain/planet/music/fin_de_cycle_phase_1.ogg.import
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="oggvorbisstr"
|
||||||
|
type="AudioStreamOggVorbis"
|
||||||
|
uid="uid://eoocn1djnep8"
|
||||||
|
path="res://.godot/imported/fin_de_cycle_phase_1.ogg-0ff8ce8f81c800fde9f50f867d824b2b.oggvorbisstr"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://stages/terrain/planet/music/fin_de_cycle_phase_1.ogg"
|
||||||
|
dest_files=["res://.godot/imported/fin_de_cycle_phase_1.ogg-0ff8ce8f81c800fde9f50f867d824b2b.oggvorbisstr"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
||||||
BIN
stages/terrain/planet/music/niveau_forestier_phase_1.ogg
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="oggvorbisstr"
|
||||||
|
type="AudioStreamOggVorbis"
|
||||||
|
uid="uid://dnskjv3wty2ms"
|
||||||
|
path="res://.godot/imported/niveau_forestier_phase_1.ogg-dbd624eb1808fe51c6958b8897206d5f.oggvorbisstr"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://stages/terrain/planet/music/niveau_forestier_phase_1.ogg"
|
||||||
|
dest_files=["res://.godot/imported/niveau_forestier_phase_1.ogg-dbd624eb1808fe51c6958b8897206d5f.oggvorbisstr"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=true
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
||||||
@ -1,17 +1,28 @@
|
|||||||
extends Terrain
|
extends Terrain
|
||||||
class_name Planet
|
class_name Planet
|
||||||
|
|
||||||
|
signal planet_stats_updated(day : int)
|
||||||
|
|
||||||
const PLANET_TEXTURE_SCALE : float = 5.0
|
const PLANET_TEXTURE_SCALE : float = 5.0
|
||||||
|
|
||||||
@export var background_texture : Texture2D
|
@export var background_texture : Texture2D
|
||||||
@export var contamination_material : ShaderMaterial
|
@export var contamination_material : ShaderMaterial
|
||||||
|
|
||||||
|
|
||||||
@onready var background_sprite : Polygon2D = generate_background_sprite()
|
@onready var background_sprite : Polygon2D = generate_background_sprite()
|
||||||
@onready var contamination_sprite : Polygon2D = generate_contamination_terrain_sprite()
|
@onready var contamination_sprite : Polygon2D = generate_contamination_terrain_sprite()
|
||||||
var contamination_texture : ImageTexture
|
|
||||||
|
|
||||||
func add_entity(e : Node2D, container : Node2D):
|
var contamination_texture : ImageTexture
|
||||||
|
var day : int = 0 :
|
||||||
|
set(v):
|
||||||
|
emit_signal("planet_stats_updated", v)
|
||||||
|
day = v
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
emit_signal("planet_stats_updated", day)
|
||||||
|
|
||||||
|
#region ------------------ Generation ------------------
|
||||||
|
|
||||||
|
func add_entity(e : Node2D, container : Node2D = entityContainer):
|
||||||
if e.get_parent():
|
if e.get_parent():
|
||||||
e.get_parent().remove_child(e)
|
e.get_parent().remove_child(e)
|
||||||
|
|
||||||
@ -20,6 +31,7 @@ func add_entity(e : Node2D, container : Node2D):
|
|||||||
|
|
||||||
container.add_child(e)
|
container.add_child(e)
|
||||||
|
|
||||||
|
|
||||||
func generate_polygon_sprite(order : int = 0) -> Polygon2D:
|
func generate_polygon_sprite(order : int = 0) -> Polygon2D:
|
||||||
var sprite = Polygon2D.new()
|
var sprite = Polygon2D.new()
|
||||||
var size = terrainData.terrainSize
|
var size = terrainData.terrainSize
|
||||||
@ -61,6 +73,25 @@ func generate_contamination_terrain_sprite() -> Polygon2D:
|
|||||||
|
|
||||||
return sprite
|
return sprite
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region ------------------ Usage ------------------
|
||||||
|
|
||||||
|
func plant(
|
||||||
|
type : PlantType,
|
||||||
|
plant_position : Vector2,
|
||||||
|
) -> bool:
|
||||||
|
if is_there_contamination(plant_position):
|
||||||
|
return false
|
||||||
|
|
||||||
|
var new_plant = Plant.new(
|
||||||
|
type,
|
||||||
|
self
|
||||||
|
)
|
||||||
|
add_entity(new_plant)
|
||||||
|
new_plant.global_position = plant_position
|
||||||
|
return true
|
||||||
|
|
||||||
func impact_contamination(impact_position : Vector2, impact_radius : int, contamination : bool = false):
|
func impact_contamination(impact_position : Vector2, impact_radius : int, contamination : bool = false):
|
||||||
terrainData.impact_contamination(impact_position, impact_radius, 0. if contamination else 1.)
|
terrainData.impact_contamination(impact_position, impact_radius, 0. if contamination else 1.)
|
||||||
if contamination_texture:
|
if contamination_texture:
|
||||||
@ -68,3 +99,14 @@ func impact_contamination(impact_position : Vector2, impact_radius : int, contam
|
|||||||
|
|
||||||
func is_there_contamination(point : Vector2) -> bool:
|
func is_there_contamination(point : Vector2) -> bool:
|
||||||
return terrainData.get_contamination(point) < 0.5
|
return terrainData.get_contamination(point) < 0.5
|
||||||
|
|
||||||
|
func pass_day():
|
||||||
|
for e : Node2D in entityContainer.get_children():
|
||||||
|
if e.has_method("pass_day"):
|
||||||
|
e.pass_day()
|
||||||
|
day += 1
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
func _on_root_gui_day_pass_proceed():
|
||||||
|
pass_day()
|
||||||
@ -14,7 +14,7 @@ func _init():
|
|||||||
if not terrainData:
|
if not terrainData:
|
||||||
terrainData = TerrainData.new()
|
terrainData = TerrainData.new()
|
||||||
|
|
||||||
func add_entity(e : Node2D, container : Node2D):
|
func add_entity(e : Node2D, container : Node2D = entityContainer):
|
||||||
if e.get_parent():
|
if e.get_parent():
|
||||||
e.get_parent().remove_child(e)
|
e.get_parent().remove_child(e)
|
||||||
|
|
||||||
@ -33,6 +33,11 @@ func create_entity_container() -> Node2D:
|
|||||||
|
|
||||||
return container
|
return container
|
||||||
|
|
||||||
|
func drop_item(item: Item, item_position : Vector2):
|
||||||
|
var item_object = ItemObject.new(item)
|
||||||
|
add_entity(item_object)
|
||||||
|
item_object.global_position = item_position
|
||||||
|
|
||||||
func create_border_limit() -> StaticBody2D:
|
func create_border_limit() -> StaticBody2D:
|
||||||
var staticBody = StaticBody2D.new()
|
var staticBody = StaticBody2D.new()
|
||||||
var staticBodyCollision = CollisionPolygon2D.new()
|
var staticBodyCollision = CollisionPolygon2D.new()
|
||||||
|
|||||||