Compare commits
2 Commits
0afb93454e
...
b0efeff809
| Author | SHA1 | Date | |
|---|---|---|---|
| b0efeff809 | |||
| f5be43767a |
@ -2,12 +2,12 @@ extends Resource
|
|||||||
class_name TerrainData
|
class_name TerrainData
|
||||||
|
|
||||||
const TERRAIN_IMAGE_GAME_FACTOR = 50
|
const TERRAIN_IMAGE_GAME_FACTOR = 50
|
||||||
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MAX_SIZE = 1000
|
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MAX_SIZE = 500
|
||||||
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MIN_SIZE = 200
|
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MIN_SIZE = 100
|
||||||
|
|
||||||
signal terrain_updated
|
signal terrain_updated
|
||||||
|
|
||||||
@export var terrainSize : Vector2 = Vector2(2000,2000)
|
@export var terrainSize : Vector2 = Vector2(1500,1500)
|
||||||
|
|
||||||
@export var contamination : Image = null
|
@export var contamination : Image = null
|
||||||
|
|
||||||
@ -68,3 +68,6 @@ func get_contamination(point : Vector2) -> float:
|
|||||||
int(round(pixel_point.x)),
|
int(round(pixel_point.x)),
|
||||||
int(round(pixel_point.y))
|
int(round(pixel_point.y))
|
||||||
).r
|
).r
|
||||||
|
|
||||||
|
func get_decontamination_coverage() -> float:
|
||||||
|
return ImageTools.get_color_coverage(contamination)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[gd_resource type="Resource" script_class="SeedItem" load_steps=3 format=3 uid="uid://lrl2okkhyxmx"]
|
[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="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://gui/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"]
|
[ext_resource type="Script" uid="uid://bypjcvlc15gsm" path="res://common/inventory/scripts/items/seed_item.gd" id="2_mgcdi"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
|
|||||||
@ -5,8 +5,11 @@ class_name Item
|
|||||||
@export var description: String
|
@export var description: String
|
||||||
@export var icon: Texture2D
|
@export var icon: Texture2D
|
||||||
|
|
||||||
func can_use() -> bool:
|
func is_one_time_use():
|
||||||
return false
|
return false
|
||||||
|
|
||||||
func use() -> bool:
|
func can_use(_player : Player) -> bool:
|
||||||
|
return false
|
||||||
|
|
||||||
|
func use(_player : Player) -> bool:
|
||||||
return false
|
return false
|
||||||
@ -1,11 +1,25 @@
|
|||||||
|
@tool
|
||||||
extends Item
|
extends Item
|
||||||
class_name SeedItem
|
class_name SeedItem
|
||||||
|
|
||||||
@export var plant_type: PlantType
|
@export var plant_type: PlantType :
|
||||||
|
set(v):
|
||||||
func _init():
|
plant_type = v
|
||||||
if plant_type:
|
if plant_type:
|
||||||
if plant_type.name:
|
|
||||||
name = plant_type.name
|
name = plant_type.name
|
||||||
if plant_type.seed_texture:
|
description = plant_type.description
|
||||||
icon = plant_type.seed_texture
|
icon = plant_type.seed_texture
|
||||||
|
|
||||||
|
func _init(_plant_type : PlantType = null):
|
||||||
|
plant_type = _plant_type
|
||||||
|
|
||||||
|
func is_one_time_use():
|
||||||
|
return true
|
||||||
|
|
||||||
|
func can_use(player : Player) -> bool:
|
||||||
|
return not player.planet.is_there_contamination(player.global_position)
|
||||||
|
|
||||||
|
func use(player : Player) -> bool:
|
||||||
|
if not can_use(player):
|
||||||
|
return false
|
||||||
|
return player.planet.plant(plant_type, player.global_position)
|
||||||
|
|||||||
@ -1,5 +1,14 @@
|
|||||||
class_name ImageTools
|
class_name ImageTools
|
||||||
|
|
||||||
|
static func get_color_coverage(image: Image, color: Color = Color.WHITE):
|
||||||
|
var pixel_color_count = 0.
|
||||||
|
for x in range(image.get_width()):
|
||||||
|
for y in range(image.get_height()):
|
||||||
|
if image.get_pixel(x, y) == color:
|
||||||
|
pixel_color_count += 1.
|
||||||
|
return pixel_color_count/(image.get_width()*image.get_height())
|
||||||
|
|
||||||
|
|
||||||
static func draw_circle(image: Image, center: Vector2i, length: int, color: Color = Color.WHITE):
|
static func draw_circle(image: Image, center: Vector2i, length: int, color: Color = Color.WHITE):
|
||||||
for x in range(image.get_width()):
|
for x in range(image.get_width()):
|
||||||
for y in range(image.get_height()):
|
for y in range(image.get_height()):
|
||||||
|
|||||||
@ -1,8 +1,36 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://bcj812ox8xv2t"]
|
[gd_scene load_steps=7 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="Script" uid="uid://reliyx2pg7kf" path="res://entities/interactables/item_object/script/item_object_sprite.gd" id="1_wing4"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bo3o2qf3i20ke" path="res://common/inventory/assets/icons/scuba-diving-tank.svg" id="2_ng3e4"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c1eiu5ag7lcp8" path="res://entities/interactables/item_object/assets/sprites/shadow.svg" id="2_ng201"]
|
[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_wing4"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Shadow:scale")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0.875, 0.875)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Icon:position")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0, 0)]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_ng201"]
|
[sub_resource type="Animation" id="Animation_ng201"]
|
||||||
resource_name = "default"
|
resource_name = "default"
|
||||||
length = 2.0
|
length = 2.0
|
||||||
@ -10,77 +38,26 @@ loop_mode = 1
|
|||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
tracks/0/enabled = true
|
tracks/0/enabled = true
|
||||||
tracks/0/path = NodePath(".:position")
|
tracks/0/path = NodePath("Shadow:scale")
|
||||||
tracks/0/interp = 2
|
tracks/0/interp = 2
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"times": PackedFloat32Array(0, 1, 2),
|
"times": PackedFloat32Array(0, 1, 2),
|
||||||
"transitions": PackedFloat32Array(1, 1, 1),
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [Vector2(0, 0), Vector2(0, -5), Vector2(0, 0)]
|
"values": [Vector2(0.875, 0.875), Vector2(0.7, 0.7), Vector2(0.875, 0.875)]
|
||||||
}
|
}
|
||||||
tracks/1/type = "value"
|
tracks/1/type = "value"
|
||||||
tracks/1/imported = false
|
tracks/1/imported = false
|
||||||
tracks/1/enabled = true
|
tracks/1/enabled = true
|
||||||
tracks/1/path = NodePath("Shadow:position")
|
tracks/1/path = NodePath("Icon:position")
|
||||||
tracks/1/interp = 2
|
tracks/1/interp = 2
|
||||||
tracks/1/loop_wrap = true
|
tracks/1/loop_wrap = true
|
||||||
tracks/1/keys = {
|
tracks/1/keys = {
|
||||||
"times": PackedFloat32Array(0, 1, 2),
|
"times": PackedFloat32Array(0, 1, 2.06667),
|
||||||
"transitions": PackedFloat32Array(1, 1, 1),
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [Vector2(0, 23), Vector2(0, 28), Vector2(0, 23)]
|
"values": [Vector2(0, 0), Vector2(0, -8), Vector2(0, 0)]
|
||||||
}
|
|
||||||
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"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ng3e4"]
|
||||||
@ -89,8 +66,11 @@ _data = {
|
|||||||
&"default": SubResource("Animation_ng201")
|
&"default": SubResource("Animation_ng201")
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="ItemObjectSprite" type="Sprite2D"]
|
[node name="ItemObjectSprite" type="Node2D"]
|
||||||
texture = ExtResource("1_7u8ru")
|
script = ExtResource("1_wing4")
|
||||||
|
|
||||||
|
[node name="Icon" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("2_ng3e4")
|
||||||
|
|
||||||
[node name="Shadow" type="Sprite2D" parent="."]
|
[node name="Shadow" type="Sprite2D" parent="."]
|
||||||
modulate = Color(1, 1, 1, 0.227451)
|
modulate = Color(1, 1, 1, 0.227451)
|
||||||
|
|||||||
@ -2,15 +2,16 @@ extends Interactable
|
|||||||
class_name ItemObject
|
class_name ItemObject
|
||||||
|
|
||||||
const ITEM_AREA_WIDTH = 10
|
const ITEM_AREA_WIDTH = 10
|
||||||
|
const ITEM_SPRITE_SIZE = 40.
|
||||||
const SPRITE_SCENE : PackedScene = preload("res://entities/interactables/item_object/item_object_sprite.tscn")
|
const SPRITE_SCENE : PackedScene = preload("res://entities/interactables/item_object/item_object_sprite.tscn")
|
||||||
|
|
||||||
@export var item : Item :
|
@export var item : Item :
|
||||||
set(_item):
|
set(_item):
|
||||||
item = _item
|
item = _item
|
||||||
if sprite:
|
if object_sprite:
|
||||||
sprite.texture = item.icon
|
object_sprite.apply_texture_to_sprite(item.icon, ITEM_SPRITE_SIZE)
|
||||||
|
|
||||||
@onready var sprite : Sprite2D = generate_sprite()
|
@onready var object_sprite : ItemObjectSprite = generate_sprite()
|
||||||
|
|
||||||
func _init(_item = null):
|
func _init(_item = null):
|
||||||
if _item:
|
if _item:
|
||||||
@ -39,10 +40,13 @@ func pickup_animation(player : Player):
|
|||||||
queue_free()
|
queue_free()
|
||||||
)
|
)
|
||||||
|
|
||||||
func generate_sprite() -> Sprite2D:
|
func generate_sprite() -> ItemObjectSprite:
|
||||||
var s = SPRITE_SCENE.instantiate() as Sprite2D
|
var spriteNode = SPRITE_SCENE.instantiate() as ItemObjectSprite
|
||||||
add_child(s)
|
add_child(spriteNode)
|
||||||
|
|
||||||
s.texture = item.icon
|
spriteNode.apply_texture_to_sprite(
|
||||||
|
item.icon,
|
||||||
|
ITEM_SPRITE_SIZE
|
||||||
|
)
|
||||||
|
|
||||||
return s
|
return spriteNode
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
extends Node2D
|
||||||
|
class_name ItemObjectSprite
|
||||||
|
|
||||||
|
@onready var iconSprite = $Icon
|
||||||
|
|
||||||
|
func apply_texture_to_sprite(texture, item_sprite_size = 50.):
|
||||||
|
iconSprite.texture = texture
|
||||||
|
iconSprite.scale = Vector2(
|
||||||
|
1./(texture.get_width()/item_sprite_size),
|
||||||
|
1./(texture.get_height()/item_sprite_size)
|
||||||
|
)
|
||||||
@ -0,0 +1 @@
|
|||||||
|
uid://reliyx2pg7kf
|
||||||
BIN
entities/plants/assets/sprites/seeds/grille_seeds.png
Normal file
BIN
entities/plants/assets/sprites/seeds/grille_seeds.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 391 KiB |
34
entities/plants/assets/sprites/seeds/grille_seeds.png.import
Normal file
34
entities/plants/assets/sprites/seeds/grille_seeds.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://pltmnkqd5ut2"
|
||||||
|
path="res://.godot/imported/grille_seeds.png-5193c30dc41cd45a15f8418b446b498e.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://entities/plants/assets/sprites/seeds/grille_seeds.png"
|
||||||
|
dest_files=["res://.godot/imported/grille_seeds.png-5193c30dc41cd45a15f8418b446b498e.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,20 +1,27 @@
|
|||||||
[gd_resource type="Resource" script_class="PlantType" load_steps=7 format=3 uid="uid://b04vho33bl52b"]
|
[gd_resource type="Resource" script_class="PlantType" load_steps=9 format=3 uid="uid://b04vho33bl52b"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://c7mp7tkkkk6o5" path="res://entities/plants/assets/sprites/default/growing.png" id="1_fp5j6"]
|
[ext_resource type="Texture2D" uid="uid://c7mp7tkkkk6o5" path="res://entities/plants/assets/sprites/default/growing.png" id="1_fp5j6"]
|
||||||
[ext_resource type="Script" path="res://entities/plants/scripts/plant_type.gd" id="1_moyj3"]
|
[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="1_moyj3"]
|
||||||
[ext_resource type="Script" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="2_cky1j"]
|
[ext_resource type="Script" 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://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"]
|
[ext_resource type="Texture2D" uid="uid://ba413oun7ry78" path="res://entities/plants/assets/sprites/default/planted.png" id="4_2s6re"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="6_cky1j"]
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_q68uy"]
|
[sub_resource type="Resource" id="Resource_q68uy"]
|
||||||
script = ExtResource("2_cky1j")
|
script = ExtResource("2_cky1j")
|
||||||
impact_radius = 100
|
impact_radius = 100
|
||||||
metadata/_custom_type_script = "uid://cgscbuxe4dawb"
|
metadata/_custom_type_script = "uid://cgscbuxe4dawb"
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ffarr"]
|
||||||
|
atlas = ExtResource("6_cky1j")
|
||||||
|
region = Rect2(1140, 345, 141, 128)
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_moyj3")
|
script = ExtResource("1_moyj3")
|
||||||
name = ""
|
name = "Chardi"
|
||||||
growing_time = 2
|
description = "This plant can grow without water, and reduce contamination around when it becomes mature."
|
||||||
|
growing_time = 1
|
||||||
|
seed_texture = SubResource("AtlasTexture_ffarr")
|
||||||
planted_texture = ExtResource("4_2s6re")
|
planted_texture = ExtResource("4_2s6re")
|
||||||
growing_texture = ExtResource("1_fp5j6")
|
growing_texture = ExtResource("1_fp5j6")
|
||||||
mature_texture = ExtResource("3_ffarr")
|
mature_texture = ExtResource("3_ffarr")
|
||||||
|
|||||||
@ -2,6 +2,7 @@ extends Resource
|
|||||||
class_name PlantType
|
class_name PlantType
|
||||||
|
|
||||||
@export var name : String
|
@export var name : String
|
||||||
|
@export_multiline var description : String
|
||||||
|
|
||||||
@export var growing_time : int
|
@export var growing_time : int
|
||||||
|
|
||||||
|
|||||||
@ -82,3 +82,4 @@ stream = SubResource("AudioStreamRandomizer_24ehl")
|
|||||||
|
|
||||||
[node name="AudioStreamPlayer_movement" type="AudioStreamPlayer" parent="Audio"]
|
[node name="AudioStreamPlayer_movement" type="AudioStreamPlayer" parent="Audio"]
|
||||||
stream = SubResource("AudioStreamRandomizer_bwdx1")
|
stream = SubResource("AudioStreamRandomizer_bwdx1")
|
||||||
|
volume_db = -20.0
|
||||||
|
|||||||
@ -6,8 +6,6 @@ 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
|
||||||
|
|
||||||
@export var testPlantType : PlantType
|
|
||||||
|
|
||||||
@onready var inventory : Inventory = Inventory.new()
|
@onready var inventory : Inventory = Inventory.new()
|
||||||
|
|
||||||
var max_energy : int = 10
|
var max_energy : int = 10
|
||||||
@ -23,6 +21,12 @@ var closest_interactable : Interactable = null :
|
|||||||
closest_interactable = v
|
closest_interactable = v
|
||||||
if old != closest_interactable:
|
if old != closest_interactable:
|
||||||
player_updated.emit(self)
|
player_updated.emit(self)
|
||||||
|
var can_use_item : bool = false :
|
||||||
|
set(v):
|
||||||
|
var old = can_use_item
|
||||||
|
can_use_item = v
|
||||||
|
if old != can_use_item:
|
||||||
|
player_updated.emit(self)
|
||||||
var energy : int = max_energy :
|
var energy : int = max_energy :
|
||||||
set(v):
|
set(v):
|
||||||
energy = v
|
energy = v
|
||||||
@ -40,8 +44,9 @@ func get_input():
|
|||||||
var old_velocity=velocity
|
var old_velocity=velocity
|
||||||
calculate_direction()
|
calculate_direction()
|
||||||
|
|
||||||
if Input.is_action_just_pressed("action") and energy > 0:
|
can_use_item = inventory.lenght() != 0 and inventory.get_item().can_use(self)
|
||||||
action()
|
if Input.is_action_just_pressed("action"):
|
||||||
|
use_item()
|
||||||
if Input.is_action_just_pressed("interact") and closest_interactable:
|
if Input.is_action_just_pressed("interact") and closest_interactable:
|
||||||
closest_interactable.interact(self)
|
closest_interactable.interact(self)
|
||||||
if Input.is_action_just_pressed("drop") and inventory.lenght() > 0:
|
if Input.is_action_just_pressed("drop") and inventory.lenght() > 0:
|
||||||
@ -56,12 +61,17 @@ 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 action():
|
func try_use_item():
|
||||||
if planet:
|
if energy > 0 and can_use_item:
|
||||||
planet.plant(
|
use_item()
|
||||||
testPlantType,
|
|
||||||
global_position
|
func use_item():
|
||||||
)
|
var item = inventory.get_item()
|
||||||
|
var is_item_used = item.use(self)
|
||||||
|
if is_item_used:
|
||||||
|
energy -= 1
|
||||||
|
if item.is_one_time_use():
|
||||||
|
inventory.pop_item()
|
||||||
|
|
||||||
func pass_day():
|
func pass_day():
|
||||||
energy = max_energy
|
energy = max_energy
|
||||||
@ -94,4 +104,4 @@ func _on_root_gui_day_pass_finished():
|
|||||||
controlling_player = true
|
controlling_player = true
|
||||||
|
|
||||||
func _on_root_gui_game_click():
|
func _on_root_gui_game_click():
|
||||||
action()
|
try_use_item()
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 887 B After Width: | Height: | Size: 887 B |
@ -3,15 +3,15 @@
|
|||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://dcgnamu7sb3ov"
|
uid="uid://dcgnamu7sb3ov"
|
||||||
path="res://.godot/imported/bolt.svg-346ec638bad7861a6c0a47abfe0480f6.ctex"
|
path="res://.godot/imported/bolt.svg-99699818681b1e0e18f4836dfd772b8c.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://gui/player_info/assets/icons/bolt.svg"
|
source_file="res://gui/assets/icons/bolt.svg"
|
||||||
dest_files=["res://.godot/imported/bolt.svg-346ec638bad7861a6c0a47abfe0480f6.ctex"]
|
dest_files=["res://.godot/imported/bolt.svg-99699818681b1e0e18f4836dfd772b8c.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 294 KiB After Width: | Height: | Size: 294 KiB |
@ -3,15 +3,15 @@
|
|||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://cm3ehinvvj52i"
|
uid="uid://cm3ehinvvj52i"
|
||||||
path="res://.godot/imported/Interface sans boutons.png-6f58a6b9570fde0ac2945334970770a8.ctex"
|
path="res://.godot/imported/Interface sans boutons.png-84e848a01e86bdad058d81d09d7731ba.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://gui/player_info/assets/texture/Interface sans boutons.png"
|
source_file="res://gui/assets/texture/Interface sans boutons.png"
|
||||||
dest_files=["res://.godot/imported/Interface sans boutons.png-6f58a6b9570fde0ac2945334970770a8.ctex"]
|
dest_files=["res://.godot/imported/Interface sans boutons.png-84e848a01e86bdad058d81d09d7731ba.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://baqrmhsgqda6v"]
|
|
||||||
|
|
||||||
[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://dcgnamu7sb3ov" path="res://gui/player_info/assets/icons/bolt.svg" id="3_s4ggy"]
|
|
||||||
[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"]
|
|
||||||
|
|
||||||
[node name="PlayerInfo" type="Control"]
|
|
||||||
custom_minimum_size = Vector2(337, 160)
|
|
||||||
layout_mode = 3
|
|
||||||
anchor_right = 0.293
|
|
||||||
anchor_bottom = 0.247
|
|
||||||
offset_right = -0.536011
|
|
||||||
offset_bottom = -0.0559998
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
size_flags_horizontal = 0
|
|
||||||
size_flags_vertical = 0
|
|
||||||
script = ExtResource("1_ghu0s")
|
|
||||||
|
|
||||||
[node name="Background" type="TextureRect" parent="."]
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = 15
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
texture = ExtResource("2_cgy6f")
|
|
||||||
expand_mode = 2
|
|
||||||
stretch_mode = 5
|
|
||||||
|
|
||||||
[node name="EnergyInfo" type="HBoxContainer" parent="."]
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = -1
|
|
||||||
anchor_left = 0.281899
|
|
||||||
anchor_top = 0.384375
|
|
||||||
anchor_right = 0.281899
|
|
||||||
anchor_bottom = 0.584375
|
|
||||||
offset_left = -44.0
|
|
||||||
offset_top = -12.5
|
|
||||||
offset_right = 44.0
|
|
||||||
offset_bottom = 12.5
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
metadata/_edit_use_anchors_ = true
|
|
||||||
|
|
||||||
[node name="Icon" type="TextureRect" parent="EnergyInfo"]
|
|
||||||
custom_minimum_size = Vector2(36.64, 0)
|
|
||||||
layout_mode = 2
|
|
||||||
texture = ExtResource("3_s4ggy")
|
|
||||||
stretch_mode = 5
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="EnergyInfo"]
|
|
||||||
layout_mode = 2
|
|
||||||
theme = ExtResource("4_cgy6f")
|
|
||||||
text = "0"
|
|
||||||
label_settings = ExtResource("5_s4ggy")
|
|
||||||
horizontal_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 +0,0 @@
|
|||||||
extends Control
|
|
||||||
|
|
||||||
func player_update(player: Player):
|
|
||||||
$EnergyInfo/Label.text = str(player.energy)
|
|
||||||
@ -1 +0,0 @@
|
|||||||
uid://bpqh8n0lbluf8
|
|
||||||
@ -1,18 +1,25 @@
|
|||||||
[gd_scene load_steps=14 format=3 uid="uid://12nak7amd1uq"]
|
[gd_scene load_steps=16 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="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://cm3ehinvvj52i" path="res://gui/assets/texture/Interface sans boutons.png" id="3_n4kem"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://gui/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://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="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="7_n4kem"]
|
||||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="8_n4kem"]
|
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="8_n4kem"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ek73b"]
|
||||||
|
atlas = ExtResource("7_n4kem")
|
||||||
|
region = Rect2(76, 75, 124, 135)
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_ek73b"]
|
[sub_resource type="LabelSettings" id="LabelSettings_ek73b"]
|
||||||
font = ExtResource("8_n4kem")
|
font = ExtResource("8_n4kem")
|
||||||
font_size = 20
|
font_size = 20
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_n4kem"]
|
||||||
|
font_size = 12
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_iyvkh"]
|
[sub_resource type="Animation" id="Animation_iyvkh"]
|
||||||
length = 0.001
|
length = 0.001
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
@ -130,8 +137,64 @@ grow_vertical = 2
|
|||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
theme = ExtResource("2_nq5i2")
|
theme = ExtResource("2_nq5i2")
|
||||||
|
|
||||||
[node name="PlayerInfo" parent="MarginContainer" instance=ExtResource("1_8kw6x")]
|
[node name="PlayerInfo" type="Control" parent="MarginContainer"]
|
||||||
|
custom_minimum_size = Vector2(337, 160)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 0
|
||||||
|
size_flags_vertical = 0
|
||||||
|
|
||||||
|
[node name="Background" type="TextureRect" parent="MarginContainer/PlayerInfo"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = ExtResource("3_n4kem")
|
||||||
|
expand_mode = 2
|
||||||
|
stretch_mode = 5
|
||||||
|
|
||||||
|
[node name="EnergyInfo" type="HBoxContainer" parent="MarginContainer/PlayerInfo"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = -1
|
||||||
|
anchor_left = 0.281899
|
||||||
|
anchor_top = 0.384375
|
||||||
|
anchor_right = 0.281899
|
||||||
|
anchor_bottom = 0.584375
|
||||||
|
offset_left = -44.0
|
||||||
|
offset_top = -12.5
|
||||||
|
offset_right = 44.0
|
||||||
|
offset_bottom = 12.5
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
metadata/_edit_use_anchors_ = true
|
||||||
|
|
||||||
|
[node name="Icon" type="TextureRect" parent="MarginContainer/PlayerInfo/EnergyInfo"]
|
||||||
|
custom_minimum_size = Vector2(36.64, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
texture = ExtResource("4_k4juk")
|
||||||
|
stretch_mode = 5
|
||||||
|
|
||||||
|
[node name="EnergyCount" type="Label" parent="MarginContainer/PlayerInfo/EnergyInfo"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("2_nq5i2")
|
||||||
|
text = "0"
|
||||||
|
label_settings = ExtResource("4_ujg5r")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="DecontaminationCoverage" type="Label" parent="MarginContainer/PlayerInfo"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 157.0
|
||||||
|
offset_top = 86.0
|
||||||
|
offset_right = 291.0
|
||||||
|
offset_bottom = 126.0
|
||||||
|
text = "100%"
|
||||||
|
label_settings = ExtResource("4_ujg5r")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="DayPass" type="Button" parent="MarginContainer"]
|
[node name="DayPass" type="Button" parent="MarginContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@ -180,8 +243,9 @@ theme = ExtResource("2_nq5i2")
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
custom_minimum_size = Vector2(0, 50)
|
custom_minimum_size = Vector2(0, 50)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
texture = ExtResource("7_n4kem")
|
texture = SubResource("AtlasTexture_ek73b")
|
||||||
stretch_mode = 3
|
expand_mode = 1
|
||||||
|
stretch_mode = 5
|
||||||
|
|
||||||
[node name="ItemName" type="Label" parent="MarginContainer/ItemInfo/MarginContainer/VBoxContainer"]
|
[node name="ItemName" type="Label" parent="MarginContainer/ItemInfo/MarginContainer/VBoxContainer"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
@ -195,6 +259,7 @@ unique_name_in_owner = true
|
|||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 3
|
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. "
|
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. "
|
||||||
|
label_settings = SubResource("LabelSettings_n4kem")
|
||||||
autowrap_mode = 3
|
autowrap_mode = 3
|
||||||
clip_text = true
|
clip_text = true
|
||||||
|
|
||||||
@ -205,6 +270,12 @@ size_flags_horizontal = 4
|
|||||||
size_flags_vertical = 8
|
size_flags_vertical = 8
|
||||||
theme = ExtResource("2_nq5i2")
|
theme = ExtResource("2_nq5i2")
|
||||||
|
|
||||||
|
[node name="Plant" type="Label" parent="MarginContainer/AvailableActions"]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
text = "space/click - Plant Seed"
|
||||||
|
label_settings = ExtResource("4_ujg5r")
|
||||||
|
|
||||||
[node name="GetItem" type="Label" parent="MarginContainer/AvailableActions"]
|
[node name="GetItem" type="Label" parent="MarginContainer/AvailableActions"]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|||||||
@ -7,11 +7,14 @@ signal day_pass_proceed
|
|||||||
signal day_pass_finished
|
signal day_pass_finished
|
||||||
|
|
||||||
func _on_player_updated(player:Player):
|
func _on_player_updated(player:Player):
|
||||||
$MarginContainer/PlayerInfo.player_update(player)
|
%EnergyCount.text = str(player.energy)
|
||||||
|
|
||||||
%AvailableActions/GetItem.visible = player.closest_interactable is ItemObject and player.inventory.lenght() == 0
|
%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/SwapItem.visible = player.closest_interactable is ItemObject and player.inventory.lenght() > 0
|
||||||
%AvailableActions/DropItem.visible = player.inventory.lenght() > 0
|
%AvailableActions/DropItem.visible = player.inventory.lenght() > 0
|
||||||
|
%AvailableActions/UseItem.visible = player.inventory.lenght() > 0 and player.can_use_item and not player.inventory.get_item() is SeedItem
|
||||||
|
%AvailableActions/Plant.visible = player.inventory.lenght() > 0 and player.can_use_item and player.inventory.get_item() is SeedItem
|
||||||
|
|
||||||
|
|
||||||
%ItemInfo.visible = player.inventory.lenght() > 0
|
%ItemInfo.visible = player.inventory.lenght() > 0
|
||||||
if player.inventory.lenght() > 0:
|
if player.inventory.lenght() > 0:
|
||||||
@ -20,9 +23,6 @@ func _on_player_updated(player:Player):
|
|||||||
%ItemName.text = item.name
|
%ItemName.text = item.name
|
||||||
%ItemDesc.text = item.description
|
%ItemDesc.text = item.description
|
||||||
|
|
||||||
func _on_planet_planet_stats_updated(day:int):
|
|
||||||
$MarginContainer/DayCount.text = "Day " + str(day)
|
|
||||||
|
|
||||||
func _on_day_pass_pressed():
|
func _on_day_pass_pressed():
|
||||||
day_pass_pressed.emit()
|
day_pass_pressed.emit()
|
||||||
$AnimationPlayer.play("recharge_fade_in")
|
$AnimationPlayer.play("recharge_fade_in")
|
||||||
@ -34,3 +34,7 @@ func _on_day_pass_pressed():
|
|||||||
|
|
||||||
func _on_game_action_button_down():
|
func _on_game_action_button_down():
|
||||||
game_click.emit()
|
game_click.emit()
|
||||||
|
|
||||||
|
func _on_planet_updated(planet:Planet):
|
||||||
|
$MarginContainer/DayCount.text = "Day " + str(planet.day)
|
||||||
|
%DecontaminationCoverage.text = str(roundi(planet.decontamination_coverage * 100)) + "%"
|
||||||
|
|||||||
26
root.tscn
26
root.tscn
@ -1,13 +1,27 @@
|
|||||||
[gd_scene load_steps=9 format=3 uid="uid://c5bruelvqbm1k"]
|
[gd_scene load_steps=13 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://b04vho33bl52b" path="res://entities/plants/resources/plants/default.tres" id="3_jnlp7"]
|
[ext_resource type="Resource" uid="uid://b04vho33bl52b" 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" path="res://entities/interactables/item_object/item_object.tscn" id="4_vyht1"]
|
[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://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"]
|
[ext_resource type="Resource" uid="uid://dbja8xm7ehw1v" path="res://common/inventory/resources/items/water_can.tres" id="6_bf3um"]
|
||||||
|
[ext_resource type="Script" uid="uid://bypjcvlc15gsm" path="res://common/inventory/scripts/items/seed_item.gd" id="6_huihk"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="6_tw3kd"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ffarr"]
|
||||||
|
atlas = ExtResource("6_tw3kd")
|
||||||
|
region = Rect2(1140, 345, 141, 128)
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_gd4vy"]
|
||||||
|
script = ExtResource("6_huihk")
|
||||||
|
plant_type = ExtResource("3_jnlp7")
|
||||||
|
name = "Chardi"
|
||||||
|
description = "This plant can grow without water, and reduce contamination around when it becomes mature."
|
||||||
|
icon = SubResource("AtlasTexture_ffarr")
|
||||||
|
metadata/_custom_type_script = "uid://bypjcvlc15gsm"
|
||||||
|
|
||||||
[node name="Root" type="Node2D"]
|
[node name="Root" type="Node2D"]
|
||||||
|
|
||||||
@ -19,12 +33,15 @@
|
|||||||
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="Shovel" parent="Entities" instance=ExtResource("4_vyht1")]
|
[node name="Shovel" parent="Entities" instance=ExtResource("4_vyht1")]
|
||||||
position = Vector2(172, -31)
|
position = Vector2(172, -31)
|
||||||
item = ExtResource("5_bf3um")
|
item = ExtResource("5_bf3um")
|
||||||
|
|
||||||
|
[node name="Seed" parent="Entities" instance=ExtResource("4_vyht1")]
|
||||||
|
position = Vector2(24, -189)
|
||||||
|
item = SubResource("Resource_gd4vy")
|
||||||
|
|
||||||
[node name="WaterCan" parent="Entities" instance=ExtResource("4_vyht1")]
|
[node name="WaterCan" parent="Entities" instance=ExtResource("4_vyht1")]
|
||||||
position = Vector2(-250, -116)
|
position = Vector2(-250, -116)
|
||||||
item = ExtResource("6_bf3um")
|
item = ExtResource("6_bf3um")
|
||||||
@ -37,8 +54,9 @@ position = Vector2(2.22, 0)
|
|||||||
following = NodePath("../Entities/Player")
|
following = NodePath("../Entities/Player")
|
||||||
|
|
||||||
[connection signal="day_pass_finished" from="CanvasLayer/RootGui" to="Entities/Player" method="_on_root_gui_day_pass_finished"]
|
[connection signal="day_pass_finished" from="CanvasLayer/RootGui" to="Entities/Player" method="_on_root_gui_day_pass_finished"]
|
||||||
|
[connection signal="day_pass_finished" from="CanvasLayer/RootGui" to="Planet" 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_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_updated" from="Entities/Player" to="CanvasLayer/RootGui" method="_on_player_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_updated" from="Planet" to="CanvasLayer/RootGui" method="_on_planet_updated"]
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
extends Terrain
|
extends Terrain
|
||||||
class_name Planet
|
class_name Planet
|
||||||
|
|
||||||
signal planet_stats_updated(day : int)
|
signal planet_updated(planet : Planet)
|
||||||
|
|
||||||
const PLANET_TEXTURE_SCALE : float = 5.0
|
const PLANET_TEXTURE_SCALE : float = 5.0
|
||||||
|
|
||||||
@ -10,15 +10,19 @@ const PLANET_TEXTURE_SCALE : float = 5.0
|
|||||||
|
|
||||||
@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()
|
||||||
|
@onready var decontamination_coverage : float = terrainData.get_decontamination_coverage() :
|
||||||
|
set(v):
|
||||||
|
decontamination_coverage = v
|
||||||
|
planet_updated.emit(self)
|
||||||
|
|
||||||
var contamination_texture : ImageTexture
|
var contamination_texture : ImageTexture
|
||||||
var day : int = 0 :
|
var day : int = 0 :
|
||||||
set(v):
|
set(v):
|
||||||
emit_signal("planet_stats_updated", v)
|
|
||||||
day = v
|
day = v
|
||||||
|
planet_updated.emit(self)
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
emit_signal("planet_stats_updated", day)
|
planet_updated.emit(self)
|
||||||
|
|
||||||
#region ------------------ Generation ------------------
|
#region ------------------ Generation ------------------
|
||||||
|
|
||||||
@ -110,3 +114,6 @@ func pass_day():
|
|||||||
|
|
||||||
func _on_root_gui_day_pass_proceed():
|
func _on_root_gui_day_pass_proceed():
|
||||||
pass_day()
|
pass_day()
|
||||||
|
|
||||||
|
func _on_root_gui_day_pass_finished():
|
||||||
|
decontamination_coverage = terrainData.get_decontamination_coverage()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user