divers changements pour la sortie du second proto
* ajout du panneau solaire #54 * ajout d'un tutoriel #53 * equilibrage du jeu #73 * ajout d'un son pour l'annonce
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://fnv0qhkh40mv"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://fnv0qhkh40mv"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_0ssee"]
|
||||
[ext_resource type="Script" uid="uid://bvb4v66bqteuc" path="res://gui/game/announce/scripts/announce.gd" id="1_4evne"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="2_yrhd4"]
|
||||
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="3_7nrno"]
|
||||
[ext_resource type="AudioStream" uid="uid://dxu6yqmaxxmmc" path="res://gui/game/announce/assets/sfx/alarm.wav" id="5_iwcrn"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vbart"]
|
||||
font = ExtResource("2_yrhd4")
|
||||
@@ -157,3 +158,8 @@ unique_name_in_owner = true
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_dvva5")
|
||||
}
|
||||
|
||||
[node name="Alarm" type="AudioStreamPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("5_iwcrn")
|
||||
pitch_scale = 2.0
|
||||
|
||||
BIN
gui/game/announce/assets/sfx/alarm.wav
Normal file
BIN
gui/game/announce/assets/sfx/alarm.wav
Normal file
Binary file not shown.
24
gui/game/announce/assets/sfx/alarm.wav.import
Normal file
24
gui/game/announce/assets/sfx/alarm.wav.import
Normal file
@@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://dxu6yqmaxxmmc"
|
||||
path="res://.godot/imported/alarm.wav-e0f6b7b4874e69f8a83b072a97c636f4.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/game/announce/assets/sfx/alarm.wav"
|
||||
dest_files=["res://.godot/imported/alarm.wav-e0f6b7b4874e69f8a83b072a97c636f4.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
|
||||
BIN
gui/game/announce/assets/sfx/quota_announcement.wav
Normal file
BIN
gui/game/announce/assets/sfx/quota_announcement.wav
Normal file
Binary file not shown.
24
gui/game/announce/assets/sfx/quota_announcement.wav.import
Normal file
24
gui/game/announce/assets/sfx/quota_announcement.wav.import
Normal file
@@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://c5ccma3y6gqtw"
|
||||
path="res://.godot/imported/quota_announcement.wav-ebdd79fb160b0596cac5cfcd6835a186.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/game/announce/assets/sfx/quota_announcement.wav"
|
||||
dest_files=["res://.godot/imported/quota_announcement.wav-ebdd79fb160b0596cac5cfcd6835a186.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
|
||||
@@ -9,3 +9,4 @@ func announce(title : String, text : String, band_color : Color = YELLOW_COLOR):
|
||||
%AnnounceText.text = text
|
||||
%AnnounceTexture.modulate = band_color
|
||||
%AnimationPlayer.play("pass")
|
||||
%Alarm.play()
|
||||
|
||||
@@ -40,7 +40,6 @@ func update(item: Item, selected : bool):
|
||||
|
||||
if item != current_item:
|
||||
%SquishAnimation.play("squish")
|
||||
print("squish")
|
||||
if item and item.icon:
|
||||
%TextureRect.texture = item.icon
|
||||
%TextureRect.visible = item != null
|
||||
|
||||
@@ -131,9 +131,8 @@ horizontal_alignment = 1
|
||||
layout_mode = 2
|
||||
text = "You are a robot who has recently arrived on a barren planet. Find and plant seeds to reduce the contamination.
|
||||
You have limited energy, but can recharge when passing days.
|
||||
You have 10 days to decontaminate as much as possible.
|
||||
PS: You can compost seeds at the bottom of the map to upgrade max enegy.
|
||||
"
|
||||
Each 7 days, you have to meet a quota of decontaminted lands.
|
||||
You get a machine to build each quota reached."
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="ControlsTitle" type="Label" parent="Tutorial/VBoxContainer"]
|
||||
@@ -144,10 +143,10 @@ horizontal_alignment = 1
|
||||
|
||||
[node name="ControlsText" type="Label" parent="Tutorial/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "QWERTY/AZERTY/Directional Arrows : Move
|
||||
text = "Directional Arrows/Right Click : Move
|
||||
Left Click : Interact/Pickup Items
|
||||
Right Click/Space : Use Item
|
||||
W : Drop Item
|
||||
Mouse Wheel : Change current item
|
||||
X : Drop Item
|
||||
"
|
||||
horizontal_alignment = 1
|
||||
|
||||
|
||||
37
gui/game/tutorial/in_game_indicator/in_game_indicator.tscn
Normal file
37
gui/game/tutorial/in_game_indicator/in_game_indicator.tscn
Normal file
@@ -0,0 +1,37 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://fh3dsuvn5h78"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_ga3ae"]
|
||||
[ext_resource type="Texture2D" uid="uid://bsgmxvuphn73c" path="res://common/icons/arrow-narrow-down.svg" id="2_kc1j1"]
|
||||
[ext_resource type="Script" uid="uid://r6hgefyycute" path="res://gui/game/tutorial/in_game_indicator/scripts/in_game_indicator.gd" id="2_kij5i"]
|
||||
|
||||
[node name="InGameIndicator" type="CenterContainer"]
|
||||
modulate = Color(0.91, 0.6521667, 0, 1)
|
||||
offset_right = 150.0
|
||||
offset_bottom = 99.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 2
|
||||
mouse_filter = 2
|
||||
theme = ExtResource("1_ga3ae")
|
||||
script = ExtResource("2_kij5i")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_ga3ae")
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(150, 0)
|
||||
layout_mode = 2
|
||||
text = "Text and a very very very long text"
|
||||
horizontal_alignment = 1
|
||||
autowrap_mode = 3
|
||||
|
||||
[node name="Arrow" type="TextureRect" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(50, 50)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
texture = ExtResource("2_kc1j1")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
@@ -0,0 +1,47 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://fh3dsuvn5h78"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_ga3ae"]
|
||||
[ext_resource type="Texture2D" uid="uid://bsgmxvuphn73c" path="res://common/icons/arrow-narrow-down.svg" id="2_kc1j1"]
|
||||
[ext_resource type="Script" uid="uid://r6hgefyycute" path="res://gui/game/tutorial/in_game_indicator/scripts/in_game_indicator.gd" id="2_kij5i"]
|
||||
|
||||
[node name="InGameIndicator" type="Control"]
|
||||
modulate = Color(0.91, 0.6521667, 0, 1)
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 50.0
|
||||
offset_bottom = 73.0
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
theme = ExtResource("1_ga3ae")
|
||||
script = ExtResource("2_kij5i")
|
||||
game_position = null
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -50.0
|
||||
offset_top = -64.5
|
||||
offset_bottom = 8.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("1_ga3ae")
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Text"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Arrow" type="TextureRect" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(50, 50)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_kc1j1")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
@@ -0,0 +1,68 @@
|
||||
extends Control
|
||||
class_name InGameIndicator
|
||||
|
||||
const UP_SHIFT = 70
|
||||
const SCREEN_MARGIN = 20
|
||||
|
||||
enum FollowingType {GAME_POS, SCREEN_POS, ENTITY}
|
||||
|
||||
var following_type: FollowingType = FollowingType.SCREEN_POS
|
||||
var following_game_position : Vector2 = Vector2()
|
||||
var following_screen_position : Vector2 = Vector2()
|
||||
var following_entity : Node2D = null
|
||||
|
||||
@export var camera : Camera2D
|
||||
|
||||
var arrow_up : Texture = preload("res://common/icons/arrow-narrow-up.svg")
|
||||
var arrow_down : Texture = preload("res://common/icons/arrow-narrow-down.svg")
|
||||
var arrow_right : Texture = preload("res://common/icons/arrow-narrow-right.svg")
|
||||
var arrow_left : Texture = preload("res://common/icons/arrow-narrow-left.svg")
|
||||
|
||||
func setup(_camera : Camera2D, text : String):
|
||||
camera = _camera
|
||||
%Label.text = text
|
||||
|
||||
func follow_game_position(game_position : Vector2):
|
||||
following_game_position = game_position
|
||||
following_type = FollowingType.GAME_POS
|
||||
|
||||
func follow_screen_position(screen_position : Vector2):
|
||||
following_screen_position = screen_position
|
||||
following_type = FollowingType.SCREEN_POS
|
||||
|
||||
func follow_entity(entity : Node2D):
|
||||
following_entity = entity
|
||||
following_type = FollowingType.ENTITY
|
||||
|
||||
func _process(_d):
|
||||
if camera:
|
||||
show()
|
||||
var screen_size = get_viewport().get_visible_rect().size
|
||||
|
||||
var abs_position : Vector2 = following_screen_position
|
||||
if following_type == FollowingType.GAME_POS:
|
||||
abs_position = following_game_position - camera.global_position + screen_size / 2 + Vector2.UP * UP_SHIFT - size/2
|
||||
elif following_type == FollowingType.ENTITY and following_entity:
|
||||
abs_position = following_entity.global_position - camera.global_position + screen_size / 2 + Vector2.UP * UP_SHIFT - size/2
|
||||
|
||||
position = Vector2(
|
||||
min(max(abs_position.x, SCREEN_MARGIN), screen_size.x - SCREEN_MARGIN),
|
||||
min(max(abs_position.y, SCREEN_MARGIN), screen_size.y - SCREEN_MARGIN)
|
||||
)
|
||||
|
||||
var arrow_texture : Texture = arrow_down
|
||||
if abs_position.y < 0:
|
||||
arrow_texture = arrow_up
|
||||
if abs_position.x < 0 :
|
||||
arrow_texture = arrow_left
|
||||
if abs_position.x > screen_size.x :
|
||||
arrow_texture = arrow_right
|
||||
position.x -= size.x
|
||||
if abs_position.y > screen_size.y :
|
||||
arrow_texture = arrow_down
|
||||
position.y -= size.y
|
||||
|
||||
|
||||
%Arrow.texture = arrow_texture
|
||||
else:
|
||||
hide()
|
||||
@@ -0,0 +1 @@
|
||||
uid://r6hgefyycute
|
||||
169
gui/game/tutorial/scripts/tutorial.gd
Normal file
169
gui/game/tutorial/scripts/tutorial.gd
Normal file
@@ -0,0 +1,169 @@
|
||||
extends Control
|
||||
class_name Tutorial
|
||||
|
||||
const INDICATOR_SCENE = preload("res://gui/game/tutorial/in_game_indicator/in_game_indicator.tscn")
|
||||
|
||||
var indicators : Array[InGameIndicator]
|
||||
@export var camera : Camera2D
|
||||
@export var player : Player
|
||||
|
||||
@onready var steps : Array[Step] = [
|
||||
TakeShovelStep.new(),
|
||||
DigLootStep.new(),
|
||||
TakeSeedStep.new(),
|
||||
PlantSeedStep.new(),
|
||||
RechargeStep.new(),
|
||||
WaitMaturePlant.new(),
|
||||
HarvestMaturePlant.new(),
|
||||
]
|
||||
var actual_step : Step = null : set = pass_to_step
|
||||
|
||||
func _process(_d):
|
||||
if not GameInfo.game_data.tutorial_done:
|
||||
if not actual_step and len(steps):
|
||||
destroy_indicators()
|
||||
pass_to_step(steps.pop_front())
|
||||
|
||||
if player and actual_step and actual_step.is_step_over(player):
|
||||
destroy_indicators()
|
||||
if len(steps):
|
||||
pass_to_step(steps.pop_front())
|
||||
else :
|
||||
GameInfo.game_data.tutorial_done = true
|
||||
|
||||
func destroy_indicators():
|
||||
for i in indicators:
|
||||
i.queue_free()
|
||||
indicators = []
|
||||
|
||||
func pass_to_step(new_step : Step):
|
||||
actual_step = new_step
|
||||
indicators = new_step.generate_indicators(camera, player)
|
||||
for i in indicators:
|
||||
add_child(i)
|
||||
|
||||
class Step:
|
||||
func generate_indicator(cam : Camera2D, text : String) -> InGameIndicator:
|
||||
var new_indicator : InGameIndicator = INDICATOR_SCENE.instantiate()
|
||||
new_indicator.setup(
|
||||
cam,
|
||||
text
|
||||
)
|
||||
return new_indicator
|
||||
|
||||
func generate_indicators(_cam : Camera2D, _player : Player) -> Array[InGameIndicator]:
|
||||
return []
|
||||
|
||||
func is_step_over(p : Player) -> bool:
|
||||
return true
|
||||
|
||||
class TakeShovelStep extends Step:
|
||||
func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]:
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
if entity is ItemObject and entity.item is Shovel:
|
||||
var indicator = generate_indicator(cam, "Take the Shovel")
|
||||
indicator.follow_entity(entity)
|
||||
return [
|
||||
indicator
|
||||
]
|
||||
printerr("No Shovel found...")
|
||||
return []
|
||||
|
||||
func is_step_over(p : Player) -> bool:
|
||||
return p.inventory.length() > 0
|
||||
|
||||
class DigLootStep extends Step:
|
||||
func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]:
|
||||
var indicators : Array[InGameIndicator] = []
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
if entity is UndergroundLoot:
|
||||
var indicator = generate_indicator(cam, "Dig Underground Loot")
|
||||
indicator.follow_entity(entity)
|
||||
indicators.append(
|
||||
indicator
|
||||
)
|
||||
return indicators
|
||||
|
||||
func is_step_over(p : Player) -> bool:
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
if entity is ItemObject and entity.item is Seed:
|
||||
return true
|
||||
return false
|
||||
|
||||
class TakeSeedStep extends Step:
|
||||
func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]:
|
||||
var indicators : Array[InGameIndicator] = []
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
if entity is ItemObject and entity.item is Seed:
|
||||
var indicator = generate_indicator(cam, "Take a seed")
|
||||
indicator.follow_entity(entity)
|
||||
indicators.append(
|
||||
indicator
|
||||
)
|
||||
return indicators
|
||||
|
||||
func is_step_over(p : Player) -> bool:
|
||||
for item in p.inventory.items:
|
||||
if item is Seed:
|
||||
return true
|
||||
return false
|
||||
|
||||
class PlantSeedStep extends Step:
|
||||
func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]:
|
||||
var indicator = generate_indicator(cam, "Plant the seed in decontamined zone")
|
||||
indicator.follow_game_position(Vector2(60,60) + p.planet.entityContainer.global_position)
|
||||
return [indicator]
|
||||
|
||||
func is_step_over(p : Player) -> bool:
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
if entity is Plant:
|
||||
return true
|
||||
return false
|
||||
|
||||
class RechargeStep extends Step:
|
||||
func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]:
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
var indicator = generate_indicator(cam, "Recharge to pass days")
|
||||
indicator.follow_entity(entity)
|
||||
if entity is RechargeStation:
|
||||
return [
|
||||
indicator
|
||||
]
|
||||
printerr("No Recharge Station found...")
|
||||
return []
|
||||
|
||||
func is_step_over(p : Player) -> bool:
|
||||
return p.planet.day > 1
|
||||
|
||||
class WaitMaturePlant extends Step:
|
||||
func generate_indicators(_cam : Camera2D, _p: Player) -> Array[InGameIndicator]:
|
||||
return []
|
||||
|
||||
func is_step_over(p : Player) -> bool:
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
if entity is Plant and entity.state == Plant.State.MATURE:
|
||||
return true
|
||||
return false
|
||||
|
||||
class HarvestMaturePlant extends Step:
|
||||
|
||||
var mature_plant_number : int = 0
|
||||
|
||||
func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]:
|
||||
var indicators : Array[InGameIndicator] = []
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
if entity is Plant and entity.state == Plant.State.MATURE:
|
||||
var indicator = generate_indicator(cam, "Harvest mature plants with shovel")
|
||||
indicator.follow_entity(entity)
|
||||
indicators.append(
|
||||
indicator
|
||||
)
|
||||
mature_plant_number += 1
|
||||
return indicators
|
||||
|
||||
func is_step_over(p : Player) -> bool:
|
||||
var actual_mature_plant_number = 0
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
if entity is Plant and entity.state == Plant.State.MATURE:
|
||||
actual_mature_plant_number += 1
|
||||
return mature_plant_number != actual_mature_plant_number
|
||||
1
gui/game/tutorial/scripts/tutorial.gd.uid
Normal file
1
gui/game/tutorial/scripts/tutorial.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://beg7favg2ukbi
|
||||
10
gui/game/tutorial/tutorial.tscn
Normal file
10
gui/game/tutorial/tutorial.tscn
Normal file
@@ -0,0 +1,10 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://dt6mptqg80dew"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://beg7favg2ukbi" path="res://gui/game/tutorial/scripts/tutorial.gd" id="1_ie1q8"]
|
||||
|
||||
[node name="Tutorial" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
script = ExtResource("1_ie1q8")
|
||||
Reference in New Issue
Block a user