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:
2025-09-26 16:56:35 +02:00
parent 6d0100d703
commit 099f8bb1be
56 changed files with 1129 additions and 87 deletions

View 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

View File

@@ -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

View File

@@ -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()

View File

@@ -0,0 +1 @@
uid://r6hgefyycute