Compare commits

...

6 Commits

41 changed files with 459 additions and 42 deletions

View File

@ -1,7 +1,12 @@
extends Resource
class_name GameData
@export var current_planet_data : PlanetData
signal current_planet_data_updated(p : PlanetData)
@export var current_planet_data : PlanetData :
set(v):
current_planet_data = v
current_planet_data_updated.emit(v)
@export var unlocked_plant_types_path : Array[PlantType] = [
preload("res://entities/plants/resources/plant_types/champ.tres"),

View File

@ -1,13 +1,19 @@
extends Resource
class_name PlanetData
signal quota_number_updated(quota : int)
signal contamination_updated(decontamination_surface : float)
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MAX_SIZE = 400.
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MIN_SIZE = 100.
const DEFAULT_BASE_SIZE = Vector2(2000,2000)
@export var base_size : Vector2 = Vector2(2000,2000)
@export var contamination : TerrainData
@export var quota_number : int = 0
@export var quota_number : int = 0 :
set(v):
quota_number = v
quota_number_updated.emit(v)
func _init(_base_size : Vector2 = DEFAULT_BASE_SIZE):
base_size = _base_size
@ -17,6 +23,7 @@ func _init(_base_size : Vector2 = DEFAULT_BASE_SIZE):
DEFAULT_CONTAMINATION_CENTRAL_ZONE_MIN_SIZE,
base_size/2
)
contamination_updated.emit(get_decontamination_surface())
func impact_contamination(position : Vector2, impact_radius : float, to_value : float = 1.):
@ -25,6 +32,7 @@ func impact_contamination(position : Vector2, impact_radius : float, to_value :
impact_radius,
to_value
)
contamination_updated.emit(get_decontamination_surface())
func is_in_base(point):
return (

View File

@ -1,6 +1,11 @@
extends Node
var game_data : GameData
signal game_data_updated(g : GameData)
var game_data : GameData :
set(v):
game_data = v
game_data_updated.emit(v)
func _init():
if not game_data:

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/bolt.svg-a559d5e701996c7d105fc68102331434.cte
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/cube-3d-sphere.svg-f86899fe00f38af995e1752e19
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/hourglass-empty.svg-e7568d697204ad5aa1416ea49
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/left_click.svg-f515b89b9c254e1eacbc2bef4d187a
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/logout.svg-15891d2f0d875a13ef182339fdbc6039.c
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/package.svg-0d0e7de2f6c04b754487a1f6252ee2a1.
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/player-pause.svg-8c388309845b649483858ace29fd
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/player-play.svg-230ff7b9a6c52930be11873163a0e
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/right_click.svg-1adb207c34017f29e28afdeafbacd
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/rotate.svg-8b3d996ae2422076b9f55d10f0455aa8.c
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/scuba-diving-tank.svg-2724f573f5956cc7af7dbc8
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/seedling.svg-86222438bce7bb2a4f266ea315728eb5
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/shovel.svg-094c34e330000cc8ea425d6acf7556bd.c
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/users-group.svg-e8465fccc5e5f0e575fcbdabcdf52
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -4,7 +4,27 @@ class_name Inventory
signal inventory_changed(inventory: Inventory)
@export var items: Array[Item] = []
@export var max_items: int = 1
@export var max_items: int = 3
var current_item_ind: int = 0
func set_current_item(new_ind: int):
if new_ind >= length():
return
if new_ind != current_item_ind:
current_item_ind = new_ind
emit_signal("inventory_changed", self)
func change_current_item(ind_mod: int):
if length() == 0:
current_item_ind = 0
return
var new_ind : int = current_item_ind + ind_mod
new_ind = new_ind % length()
if new_ind < 0:
new_ind += length()
set_current_item(new_ind)
func add_item(item: Item):
if items.size() < max_items:
@ -28,10 +48,10 @@ func add_items(items_to_add: Array[Item], fillup: bool = false):
emit_signal("inventory_changed", self)
return true
func lenght() -> int:
func length() -> int:
return len(items)
func set_item(item : Item, ind: int = 0) -> bool:
func set_item(item: Item, ind: int = 0) -> bool:
if ind >= max_items:
return false
while len(items) <= ind:
@ -40,26 +60,41 @@ func set_item(item : Item, ind: int = 0) -> bool:
emit_signal("inventory_changed", self)
return true
func get_item(ind: int = 0) -> Item:
func get_item(ind: int = current_item_ind) -> Item:
if len(items) <= ind:
return null;
return null
return items[ind]
func has_item(item : Item) -> bool:
func has_item(item: Item) -> bool:
return item in items
func remove_item(item : Item):
func remove_item(item: Item):
items.erase(item)
emit_signal("inventory_changed", self)
func pop_item(ind: int = 0) -> Item:
func remove_item_at(ind: int = current_item_ind):
if len(items) <= ind:
return
items.remove_at(ind)
if current_item_ind >= length():
change_current_item(-1)
emit_signal("inventory_changed", self)
func remove_current_item():
remove_item_at()
func pop_item(ind: int = current_item_ind) -> Item:
if length() == 0:
return
var item_removed: Item = items.pop_at(ind)
if current_item_ind >= length():
change_current_item(-1)
emit_signal("inventory_changed", self)
return item_removed
func swap_items(item_to_add: Item, ind_to_get: int = 0) -> Item:
func swap_items(item_to_add: Item, ind_to_get: int = current_item_ind) -> Item:
var item_to_get := items[ind_to_get]
items[ind_to_get] = item_to_add
emit_signal("inventory_changed", self)
return item_to_get

View File

@ -12,7 +12,7 @@ dest_files=["res://.godot/imported/forest_phase_1.ogg-08213a81a42ba2cf4c67c1bfac
[params]
loop=false
loop=true
loop_offset=0
bpm=0
beat_count=0

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://bqwiaek5b5q00"
path="res://.godot/imported/forest_phase_2.ogg-b312ca5fea9e7b3157a9ab7a4cb99dc9.oggvorbisstr"
[deps]
source_file="res://common/music/assets/forest_phase_2.ogg"
dest_files=["res://.godot/imported/forest_phase_2.ogg-b312ca5fea9e7b3157a9ab7a4cb99dc9.oggvorbisstr"]
[params]
loop=true
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -12,7 +12,7 @@ dest_files=["res://.godot/imported/vent.ogg-ae488051619e48b592cdcb0ef4467441.ogg
[params]
loop=false
loop=true
loop_offset=0
bpm=0
beat_count=0

View File

@ -1,17 +1,25 @@
[gd_scene load_steps=3 format=3 uid="uid://b6hscxcrj065q"]
[gd_scene load_steps=5 format=3 uid="uid://b6hscxcrj065q"]
[ext_resource type="Script" uid="uid://2p5d6vogtn82" path="res://common/music/scripts/music.gd" id="1_ji160"]
[ext_resource type="AudioStream" uid="uid://diyefcv8tqa3r" path="res://common/music/assets/forest_phase_1.ogg" id="1_stre8"]
[ext_resource type="AudioStream" uid="uid://bqwiaek5b5q00" path="res://common/music/assets/forest_phase_2.ogg" id="2_ji160"]
[ext_resource type="AudioStream" uid="uid://d1fyd5o331360" path="res://common/music/assets/vent.ogg" id="2_n52pk"]
[node name="Music" type="Node"]
[node name="Music" type="Node" node_paths=PackedStringArray("decontamination_musics")]
process_mode = 3
script = ExtResource("1_ji160")
decontamination_musics = [NodePath("ForestPhase1"), NodePath("ForestPhase2")]
decontamination_musics_levels = Array[float]([0.0, 30.0])
[node name="AudioStreamPlayer_music" type="AudioStreamPlayer" parent="."]
[node name="ForestPhase1" type="AudioStreamPlayer" parent="."]
stream = ExtResource("1_stre8")
autoplay = true
parameters/looping = false
volume_db = -10.0
[node name="AudioStreamPlayer2_ambient" type="AudioStreamPlayer" parent="."]
[node name="ForestPhase2" type="AudioStreamPlayer" parent="."]
stream = ExtResource("2_ji160")
volume_db = -10.0
[node name="Wind" type="AudioStreamPlayer" parent="."]
stream = ExtResource("2_n52pk")
autoplay = true
parameters/looping = false

View File

@ -0,0 +1,63 @@
extends Node
@export var default_fade_time = 1.0
@export var decontamination_musics : Array[AudioStreamPlayer]
@export var decontamination_musics_levels : Array[float]
@onready var playing_music = null : set = play_music
func _ready():
GameInfo.game_data.current_planet_data_updated.connect(_on_current_planet_data_updated)
func _on_current_planet_data_updated(planet_data : PlanetData):
if planet_data:
planet_data.contamination_updated.connect(_on_contamination_updated)
if len(decontamination_musics):
play_music(decontamination_musics[0])
func _on_contamination_updated(decontamination_surface : float):
var actual_level = 0
if len(decontamination_musics_levels) and len(decontamination_musics):
for level in range(1, len(decontamination_musics_levels)):
if decontamination_surface > decontamination_musics_levels[level]:
actual_level = level
print(actual_level)
if len(decontamination_musics) > actual_level:
play_music(decontamination_musics[actual_level])
func stop_music():
play_music(null)
func play_music(music : AudioStreamPlayer):
if playing_music != null:
if playing_music != music:
if playing_music:
await audio_fade(playing_music, false).finished
if music:
music.play()
elif music != null and music != playing_music:
music.play()
playing_music = music
func audio_fade(music : AudioStreamPlayer, fade_in = true, fade_time = default_fade_time) -> Tween:
var fade_tween : Tween = get_tree().create_tween()
var music_default_volume = music.volume_db
var target_volume = music_default_volume if fade_in else -80.
if fade_in:
music.volume_db = -80.
music.play()
fade_tween.tween_property(music, "volume_db", target_volume, fade_time)
if not fade_in:
fade_tween.finished.connect(
func():
music.stop()
music.volume_db = music_default_volume
)
return fade_tween

View File

@ -0,0 +1 @@
uid://2p5d6vogtn82

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://bcj812ox8xv2t"]
[gd_scene load_steps=8 format=3 uid="uid://bcj812ox8xv2t"]
[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/icons/scuba-diving-tank.svg" id="2_ng3e4"]
@ -30,6 +30,18 @@ tracks/1/keys = {
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".:scale")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(1, 1)]
}
[sub_resource type="Animation" id="Animation_ng201"]
resource_name = "default"
@ -60,10 +72,27 @@ tracks/1/keys = {
"values": [Vector2(0, 0), Vector2(0, -8), Vector2(0, 0)]
}
[sub_resource type="Animation" id="Animation_ng3e4"]
resource_name = "pickup"
length = 0.3
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:scale")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.3),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(1, 1), Vector2(0, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ng3e4"]
_data = {
&"RESET": SubResource("Animation_wing4"),
&"default": SubResource("Animation_ng201")
&"default": SubResource("Animation_ng201"),
&"pickup": SubResource("Animation_ng3e4")
}
[node name="ItemObjectSprite" type="Node2D"]
@ -80,6 +109,7 @@ scale = Vector2(0.875, 0.875)
texture = ExtResource("2_ng201")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
&"": SubResource("AnimationLibrary_ng3e4")
}

View File

@ -43,9 +43,7 @@ func inspector_info() -> Inspector.Info:
)
func interact(player : Player) -> bool:
var swapped_item = player.inventory.get_item()
player.get_item(item)
var swapped_item = player.pick_item(item)
if swapped_item:
item = swapped_item
@ -63,6 +61,7 @@ func pickup_animation(player : Player):
func():
queue_free()
)
object_sprite.pickup_animation()
func generate_sprite() -> ItemObjectSprite:
var spriteNode = SPRITE_SCENE.instantiate() as ItemObjectSprite

View File

@ -10,3 +10,6 @@ func apply_texture_to_sprite(texture, item_sprite_size = 50.):
1./(texture.get_width()/item_sprite_size),
1./(texture.get_height()/item_sprite_size)
)
func pickup_animation():
%AnimationPlayer.play("pickup")

View File

@ -1,7 +1,7 @@
[gd_resource type="Resource" script_class="MachineType" load_steps=3 format=3 uid="uid://cv2tf0tydqj5v"]
[ext_resource type="PackedScene" uid="uid://bkwh1ntvgkkrt" path="res://entities/interactables/machines/compost/compost.tscn" id="1_8ajib"]
[ext_resource type="Script" uid="uid://bhncww816fjsb" path="res://entities/interactables/machines/scripts/machine_info.gd" id="1_vktn1"]
[ext_resource type="Script" path="res://entities/interactables/machines/scripts/machine_info.gd" id="1_vktn1"]
[resource]
script = ExtResource("1_vktn1")

View File

@ -30,7 +30,7 @@ func interact(p : Player) -> bool:
return false
p.play_sfx("harvest")
p.delete_item(p.inventory.get_item())
p.inventory.remove_current_item()
containing_seed += 1
if containing_seed >= get_seed_needed():
$AnimationPlayer.play("empty")

View File

@ -4,7 +4,7 @@ class_name Interactable
var available : bool = true
func can_interact(_p : Player) -> bool:
return true
return available
func interaction_cost(_p : Player) -> int:
return 0

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/arbre_mort.png-eea217ee3fbf6520e6fbde71f18bbe
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/little_plant.png-e9ed84e9420c629c3911ff755b19
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@ -111,11 +111,11 @@ pitch_scale = 1.5
[node name="AudioStreamPlayer_pick_up" type="AudioStreamPlayer" parent="Audio"]
stream = SubResource("AudioStreamRandomizer_24ehl")
volume_db = -15.0
volume_db = -25.0
[node name="AudioStreamPlayer_movement" type="AudioStreamPlayer" parent="Audio"]
stream = SubResource("AudioStreamRandomizer_bwdx1")
volume_db = -20.0
volume_db = -80.0
[node name="AudioStreamPlayer_drop" type="AudioStreamPlayer" parent="Audio"]
stream = SubResource("AudioStreamRandomizer_yqrof")

View File

@ -34,6 +34,15 @@ func _ready():
inventory.inventory_changed.connect(_on_inventory_updated)
Pointer.player = self
func _input(_event) -> void:
if Input.is_action_pressed("change_item_left"):
inventory.change_current_item(1)
if Input.is_action_pressed("change_item_right"):
inventory.change_current_item(-1)
for i in range(1, 10):
if Input.is_action_pressed("item_" + str(i)):
inventory.set_current_item(i - 1)
# Méthode déclenchée par la classe planet
func _start_pass_day():
controlling_player = false
@ -67,16 +76,17 @@ func _process(_delta):
move_and_slide()
func _on_inventory_updated(_inventory: Inventory):
if inventory.get_item():
setup_preview_zone(inventory.get_item().usage_zone_radius)
var item_texture = inventory.get_item().icon
var item : Item = inventory.get_item()
if item:
setup_preview_zone(item.usage_zone_radius)
var item_texture = item.icon
%ItemSprite.texture = item_texture
%ItemSprite.scale = Vector2(
1./(item_texture.get_width()/HOLDING_ITEM_SPRITE_SIZE),
1./(item_texture.get_height()/HOLDING_ITEM_SPRITE_SIZE)
)
%HideEyes.visible = inventory.get_item() != null
%ItemSprite.visible = inventory.get_item() != null
%HideEyes.visible = item != null
%ItemSprite.visible = item != null
emit_signal("player_updated", self)
@ -112,9 +122,18 @@ func try_interact(interactable : Interactable):
func try_move(move_to : Vector2):
instruction = MoveInstruction.new(move_to)
func get_item(item : Item):
inventory.set_item(item)
func pick_item(item : Item) -> Item:
var itemAdded = inventory.add_item(item)
var currentItem : Item = inventory.get_item()
var itemSwapped : bool = false
if itemAdded:
inventory.set_current_item(inventory.length() - 1)
else:
itemSwapped = inventory.set_item(item, inventory.current_item_ind)
play_sfx("pick")
if !itemSwapped:
currentItem = null
return currentItem
func drop_item():
var item_to_drop = inventory.pop_item()
@ -148,7 +167,7 @@ func use_item(item : Item):
if is_item_used:
energy -= item.energy_usage
if item.is_one_time_use():
delete_item(item)
inventory.remove_current_item()
func upgrade_max_energy(amount = 1):
max_energy += amount

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=28 format=3 uid="uid://12nak7amd1uq"]
[gd_scene load_steps=30 format=3 uid="uid://12nak7amd1uq"]
[ext_resource type="Script" uid="uid://cqao7n800qy40" path="res://gui/game/scripts/game_gui.gd" id="1_udau0"]
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="2_nq5i2"]
@ -7,7 +7,9 @@
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="4_k4juk"]
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="4_ujg5r"]
[ext_resource type="PackedScene" uid="uid://d3lff5fui1k0c" path="res://gui/game/inspector/inspector.tscn" id="6_dr1y2"]
[ext_resource type="Texture2D" uid="uid://bf6nw4onkhavr" path="res://common/icons/shovel.svg" id="8_h6540"]
[ext_resource type="Texture2D" uid="uid://b5cuxgisrsfgt" path="res://common/icons/player-pause.svg" id="9_2wykm"]
[ext_resource type="Texture2D" uid="uid://bupl1y0cfj21q" path="res://entities/plants/assets/sprites/chardi/mature.png" id="9_id0t5"]
[sub_resource type="Gradient" id="Gradient_id0t5"]
interpolation_mode = 1
@ -375,6 +377,33 @@ focus_mode = 0
mouse_filter = 1
icon = ExtResource("9_2wykm")
[node name="Inventory" type="HBoxContainer" parent="MarginContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(48, 48)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
[node name="TextureRect" type="TextureRect" parent="MarginContainer/Inventory"]
modulate = Color(1, 0, 1, 1)
custom_minimum_size = Vector2(48, 48)
layout_mode = 2
texture = ExtResource("8_h6540")
expand_mode = 3
[node name="TextureRect2" type="TextureRect" parent="MarginContainer/Inventory"]
custom_minimum_size = Vector2(48, 48)
layout_mode = 2
texture = ExtResource("4_k4juk")
expand_mode = 3
[node name="TextureRect3" type="TextureRect" parent="MarginContainer/Inventory"]
modulate = Color(1, 0.37254903, 0.101960786, 1)
custom_minimum_size = Vector2(48, 48)
layout_mode = 2
texture = ExtResource("9_id0t5")
expand_mode = 3
[node name="PassDayFade" type="ColorRect" parent="."]
physics_interpolation_mode = 0
layout_mode = 1

View File

@ -10,6 +10,24 @@ func _on_player_updated(player:Player):
%EnergyCount.text = str(player.energy) + "/" + str(player.max_energy)
%EnergyInfo.modulate = Color.WHITE if player.energy > 0 else Color.RED
for i in player.inventory.max_items:
var item : Item = player.inventory.get_item(i)
if item:
if %Inventory.get_child_count() <= i:
var texture_rect = TextureRect.new()
texture_rect.expand_mode = TextureRect.EXPAND_FIT_WIDTH_PROPORTIONAL
%Inventory.add_child(texture_rect)
%Inventory.get_child(i).texture = item.icon
%Inventory.get_child(i).visible = true
if i == player.inventory.current_item_ind:
%Inventory.get_child(i).modulate = Color.WHITE
else:
%Inventory.get_child(i).modulate = Color.DARK_GRAY
else:
if %Inventory.get_child_count() > i:
%Inventory.get_child(i).visible = false
update_no_energy_left_info(player.energy)
func _on_planet_updated(planet:Planet):

View File

@ -69,6 +69,61 @@ move={
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(231, 25),"global_position":Vector2(240, 73),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}
change_item_right={
"deadzone": 0.2,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"canceled":false,"pressed":false,"double_click":false,"script":null)
]
}
change_item_left={
"deadzone": 0.2,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":5,"canceled":false,"pressed":false,"double_click":false,"script":null)
]
}
item_1={
"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":49,"key_label":0,"unicode":38,"location":0,"echo":false,"script":null)
]
}
item_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":50,"key_label":0,"unicode":233,"location":0,"echo":false,"script":null)
]
}
item_3={
"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":51,"key_label":0,"unicode":34,"location":0,"echo":false,"script":null)
]
}
item_4={
"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":52,"key_label":0,"unicode":39,"location":0,"echo":false,"script":null)
]
}
item_5={
"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":53,"key_label":0,"unicode":40,"location":0,"echo":false,"script":null)
]
}
item_6={
"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":54,"key_label":0,"unicode":45,"location":0,"echo":false,"script":null)
]
}
item_7={
"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":55,"key_label":0,"unicode":232,"location":0,"echo":false,"script":null)
]
}
item_8={
"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":56,"key_label":0,"unicode":95,"location":0,"echo":false,"script":null)
]
}
item_9={
"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":57,"key_label":0,"unicode":231,"location":0,"echo":false,"script":null)
]
}
[rendering]

View File

@ -3,7 +3,7 @@
[ext_resource type="Script" uid="uid://c54457tbocdwk" path="res://gui/menu/scripts/menu.gd" id="1_bf3um"]
[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/planet/assets/textures/sol_gamejam_normal.png" id="2_huihk"]
[ext_resource type="Texture2D" uid="uid://dcn4cq53h1qiy" path="res://stages/terrain/planet/resources/textures/sol_gamejam_fleurs_transp.png" id="3_tw3kd"]
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="4_gd4vy"]
[ext_resource type="Theme" uid="uid://ldxkd6wn5qu1" path="res://gui/ressources/default_theme.tres" id="4_gd4vy"]
[ext_resource type="Texture2D" uid="uid://nx4wxpr6mk8l" path="res://gui/menu/assets/texture/SeedingPlanetsLogo.png" id="5_qw60f"]
[ext_resource type="Texture2D" uid="uid://03ijmo6xlytu" path="res://gui/menu/assets/texture/abre1glow.png" id="6_eji0w"]
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="7_qwhpj"]

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://6bud8chekm8v"
path="res://.godot/imported/alarm.wav-4982454a388199bced4344e009ba7c4b.sample"
[deps]
source_file="res://stages/terrain/planet/assets/sounds/alarm.wav"
dest_files=["res://.godot/imported/alarm.wav-4982454a388199bced4344e009ba7c4b.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2