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