inventaire #35
1
common/inventory/assets/icons/scuba-diving-tank.svg
Normal file
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
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
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
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
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
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
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
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
1
common/inventory/scripts/inventory.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://fnu2d6wna4yc
|
||||||
12
common/inventory/scripts/item.gd
Normal file
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
1
common/inventory/scripts/item.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://bq7admu4ahs5r
|
||||||
11
common/inventory/scripts/items/seed_item.gd
Normal file
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
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
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
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
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
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,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
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://clpcqkdlj3d8e"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cega715smavh3" path="res://entities/plants/scripts/plant.gd" id="1_d8u7e"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://c6vby5r0pfni2" path="res://entities/plants/assets/sprites/default_plant.png" id="4_dq24f"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://b3wom2xu26g43" path="res://entities/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")
|
|
||||||
|
|
||||||
[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,6 +1,8 @@
|
|||||||
extends Resource
|
extends Resource
|
||||||
class_name PlantType
|
class_name PlantType
|
||||||
|
|
||||||
|
@export var name : String
|
||||||
|
|
||||||
@export var growing_time : int
|
@export var growing_time : int
|
||||||
|
|
||||||
@export var seed_texture : Texture
|
@export var seed_texture : Texture
|
||||||
|
|||||||
@ -13,16 +13,16 @@ radius = 40.0
|
|||||||
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")
|
||||||
|
|||||||
@ -1,23 +1,39 @@
|
|||||||
extends CharacterBody2D
|
extends CharacterBody2D
|
||||||
class_name Player
|
class_name Player
|
||||||
|
|
||||||
signal player_stats_updated(player : Player)
|
signal player_updated(player: Player)
|
||||||
|
|
||||||
var controlling_player : bool = true
|
|
||||||
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
|
||||||
|
|
||||||
@export var testPlantType : PlantType
|
@export var testPlantType : PlantType
|
||||||
|
|
||||||
|
@onready var inventory : Inventory = Inventory.new()
|
||||||
|
|
||||||
var max_energy : int = 10
|
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 :
|
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:
|
if controlling_player:
|
||||||
@ -25,9 +41,14 @@ func get_input():
|
|||||||
|
|
||||||
if Input.is_action_just_pressed("action") and energy > 0:
|
if Input.is_action_just_pressed("action") and energy > 0:
|
||||||
action()
|
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")
|
||||||
velocity = input_direction * speed
|
velocity = input_direction * speed
|
||||||
if input_direction.x:
|
if input_direction.x:
|
||||||
$Sprite.flip_h = (input_direction.x < 0)
|
$Sprite.flip_h = (input_direction.x < 0)
|
||||||
@ -42,9 +63,26 @@ func action():
|
|||||||
func pass_day():
|
func pass_day():
|
||||||
energy = max_energy
|
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():
|
func _on_root_gui_day_pass_pressed():
|
||||||
controlling_player = false
|
controlling_player = false
|
||||||
|
|||||||
BIN
gui/assets/texture/Tablette info.png
Normal file
BIN
gui/assets/texture/Tablette info.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 285 KiB |
34
gui/assets/texture/Tablette info.png.import
Normal file
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
|
||||||
@ -58,3 +58,11 @@ text = "0"
|
|||||||
label_settings = ExtResource("5_s4ggy")
|
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
BIN
gui/ressources/Tablette info.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 285 KiB |
34
gui/ressources/Tablette info.png.import
Normal file
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
|
||||||
@ -1,6 +1,6 @@
|
|||||||
[gd_resource type="LabelSettings" load_steps=2 format=3 uid="uid://dqwayi8yjwau2"]
|
[gd_resource type="LabelSettings" load_steps=2 format=3 uid="uid://dqwayi8yjwau2"]
|
||||||
|
|
||||||
[ext_resource type="FontFile" uid="uid://byyfovm1ha5ya" path="res://gui/ressources/fonts/AtomicMd-3zXDZ.ttf" id="1_w0wva"]
|
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="1_w0wva"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
font = ExtResource("1_w0wva")
|
font = ExtResource("1_w0wva")
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[gd_resource type="Theme" load_steps=5 format=3 uid="uid://bgcmd213j6gk1"]
|
[gd_resource type="Theme" load_steps=5 format=3 uid="uid://bgcmd213j6gk1"]
|
||||||
|
|
||||||
[ext_resource type="FontFile" uid="uid://byyfovm1ha5ya" path="res://gui/ressources/fonts/AtomicMd-3zXDZ.ttf" id="1_hv6r3"]
|
[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"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_hv6r3"]
|
||||||
bg_color = Color(0.976471, 0.741176, 0.4, 1)
|
bg_color = Color(0.976471, 0.741176, 0.4, 1)
|
||||||
@ -44,7 +44,8 @@ Button/fonts/font = ExtResource("1_hv6r3")
|
|||||||
Button/styles/hover = SubResource("StyleBoxFlat_hv6r3")
|
Button/styles/hover = SubResource("StyleBoxFlat_hv6r3")
|
||||||
Button/styles/normal = SubResource("StyleBoxFlat_y48f0")
|
Button/styles/normal = SubResource("StyleBoxFlat_y48f0")
|
||||||
Button/styles/pressed = SubResource("StyleBoxFlat_st1o2")
|
Button/styles/pressed = SubResource("StyleBoxFlat_st1o2")
|
||||||
MarginContainer/constants/margin_bottom = 10
|
HBoxContainer/constants/separation = 15
|
||||||
MarginContainer/constants/margin_left = 10
|
MarginContainer/constants/margin_bottom = 15
|
||||||
MarginContainer/constants/margin_right = 10
|
MarginContainer/constants/margin_left = 15
|
||||||
MarginContainer/constants/margin_top = 10
|
MarginContainer/constants/margin_right = 15
|
||||||
|
MarginContainer/constants/margin_top = 15
|
||||||
|
|||||||
BIN
gui/ressources/fonts/spincycle_3d_ot.otf
Normal file
BIN
gui/ressources/fonts/spincycle_3d_ot.otf
Normal file
Binary file not shown.
35
gui/ressources/fonts/spincycle_3d_ot.otf.import
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
BIN
gui/ressources/fonts/spincycle_ot.otf
Normal file
Binary file not shown.
35
gui/ressources/fonts/spincycle_ot.otf.import
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,25 +1,17 @@
|
|||||||
[gd_scene load_steps=10 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="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="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="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="Animation" id="Animation_k4juk"]
|
[sub_resource type="LabelSettings" id="LabelSettings_ek73b"]
|
||||||
resource_name = "recharge_fade_in"
|
font = ExtResource("8_n4kem")
|
||||||
tracks/0/type = "value"
|
font_size = 20
|
||||||
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)]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_iyvkh"]
|
[sub_resource type="Animation" id="Animation_iyvkh"]
|
||||||
length = 0.001
|
length = 0.001
|
||||||
@ -35,6 +27,45 @@ tracks/0/keys = {
|
|||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [Color(0, 0, 0, 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"]
|
[sub_resource type="Animation" id="Animation_fovlv"]
|
||||||
resource_name = "recharge_fade_out"
|
resource_name = "recharge_fade_out"
|
||||||
@ -50,6 +81,18 @@ tracks/0/keys = {
|
|||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 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"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_n4kem"]
|
||||||
_data = {
|
_data = {
|
||||||
@ -106,15 +149,95 @@ size_flags_horizontal = 8
|
|||||||
size_flags_vertical = 0
|
size_flags_vertical = 0
|
||||||
label_settings = ExtResource("4_ujg5r")
|
label_settings = ExtResource("4_ujg5r")
|
||||||
|
|
||||||
[node name="RechargeFade" type="ColorRect" parent="."]
|
[node name="ItemInfo" type="TextureRect" parent="MarginContainer"]
|
||||||
physics_interpolation_mode = 0
|
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
|
layout_mode = 1
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
mouse_filter = 2
|
|
||||||
color = Color(0, 0, 0, 0)
|
color = Color(0, 0, 0, 0)
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
@ -122,6 +245,10 @@ libraries = {
|
|||||||
&"": SubResource("AnimationLibrary_n4kem")
|
&"": SubResource("AnimationLibrary_n4kem")
|
||||||
}
|
}
|
||||||
|
|
||||||
[connection signal="player_stats_updated" from="." to="MarginContainer/PlayerInfo" method="_on_root_gui_player_stats_updated"]
|
[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="button_down" from="GameAction" to="." method="_on_game_action_button_down"]
|
||||||
[connection signal="pressed" from="MarginContainer/DayPass" to="." method="_on_day_pass_pressed"]
|
[connection signal="pressed" from="MarginContainer/DayPass" to="." method="_on_day_pass_pressed"]
|
||||||
|
|||||||
@ -1,15 +1,24 @@
|
|||||||
extends Control
|
extends Control
|
||||||
class_name RootGui
|
class_name RootGui
|
||||||
|
|
||||||
signal player_stats_updated(player : Player)
|
|
||||||
signal game_click
|
signal game_click
|
||||||
signal day_pass_pressed
|
signal day_pass_pressed
|
||||||
signal day_pass_proceed
|
signal day_pass_proceed
|
||||||
signal day_pass_finished
|
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):
|
func _on_planet_planet_stats_updated(day:int):
|
||||||
$MarginContainer/DayCount.text = "Day " + str(day)
|
$MarginContainer/DayCount.text = "Day " + str(day)
|
||||||
|
|||||||
@ -41,11 +41,21 @@ move_down={
|
|||||||
, 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":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
, 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":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
interact={
|
||||||
|
"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":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
action={
|
action={
|
||||||
"deadzone": 0.2,
|
"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)
|
"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)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
|
|||||||
15
root.tscn
15
root.tscn
@ -1,10 +1,13 @@
|
|||||||
[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="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://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"]
|
||||||
|
|
||||||
[node name="Root" type="Node2D"]
|
[node name="Root" type="Node2D"]
|
||||||
|
|
||||||
@ -18,6 +21,14 @@ 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")
|
testPlantType = ExtResource("3_jnlp7")
|
||||||
|
|
||||||
|
[node name="Shovel" parent="Entities" instance=ExtResource("4_vyht1")]
|
||||||
|
position = Vector2(172, -31)
|
||||||
|
item = ExtResource("5_bf3um")
|
||||||
|
|
||||||
|
[node name="WaterCan" parent="Entities" instance=ExtResource("4_vyht1")]
|
||||||
|
position = Vector2(-250, -116)
|
||||||
|
item = ExtResource("6_bf3um")
|
||||||
|
|
||||||
[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")
|
||||||
|
|
||||||
@ -29,5 +40,5 @@ following = NodePath("../Entities/Player")
|
|||||||
[connection signal="day_pass_pressed" from="CanvasLayer/RootGui" to="Entities/Player" method="_on_root_gui_day_pass_pressed"]
|
[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="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="game_click" from="CanvasLayer/RootGui" to="Entities/Player" method="_on_root_gui_game_click"]
|
||||||
[connection signal="player_stats_updated" from="Entities/Player" to="CanvasLayer/RootGui" method="_on_player_player_stats_updated"]
|
[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"]
|
[connection signal="planet_stats_updated" from="Planet" to="CanvasLayer/RootGui" method="_on_planet_planet_stats_updated"]
|
||||||
|
|||||||
@ -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()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user