developpement d'écran de chargement et d'écran de sélection de niveau
* modification de certains assets * optimisation de chunks * ajout d'un SceneManager * ajout d'un premier dialogue avec Demeter * changement des jour en charge * mise en place d'un système de run * etc...
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=5 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="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/hud.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"]
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@ class_name InGameBaseIndicator
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
setup(tr("GARDEN"))
|
||||
follow_game_position(GameInfo.game_data.current_planet_data.garden_size/2)
|
||||
follow_game_position(Planet.CHUNK_SIZE / 2. * Vector2.ONE)
|
||||
|
||||
func _process(_delta):
|
||||
visible = player and (
|
||||
player.global_position.x < 0
|
||||
or player.global_position.x > GameInfo.game_data.current_planet_data.garden_size.x
|
||||
or player.global_position.x > Planet.CHUNK_SIZE
|
||||
or player.global_position.y < 0
|
||||
or player.global_position.y > GameInfo.game_data.current_planet_data.garden_size.y
|
||||
or player.global_position.y > Planet.CHUNK_SIZE
|
||||
)
|
||||
update()
|
||||
|
||||
@@ -17,51 +17,51 @@ 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(text : String):
|
||||
%Label.text = text
|
||||
%Label.text = text
|
||||
|
||||
func follow_game_position(game_position : Vector2):
|
||||
following_game_position = game_position
|
||||
following_type = FollowingType.GAME_POS
|
||||
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
|
||||
following_screen_position = screen_position
|
||||
following_type = FollowingType.SCREEN_POS
|
||||
|
||||
func follow_entity(entity : Node2D):
|
||||
following_entity = entity
|
||||
following_type = FollowingType.ENTITY
|
||||
following_entity = entity
|
||||
following_type = FollowingType.ENTITY
|
||||
|
||||
func _process(_d):
|
||||
show()
|
||||
update()
|
||||
show()
|
||||
update()
|
||||
|
||||
func update():
|
||||
var camera = get_viewport().get_camera_2d()
|
||||
var camera = get_viewport().get_camera_2d()
|
||||
|
||||
var screen_size = get_viewport().get_visible_rect().size
|
||||
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
|
||||
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)
|
||||
)
|
||||
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
|
||||
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
|
||||
|
||||
%Arrow.texture = arrow_texture
|
||||
|
||||
Reference in New Issue
Block a user