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