Cambiados los aspectos visuales del juego a algo gotico
This commit is contained in:
1 parent
ec7e35ddf6
commit
967b3a286d
205 files changed
+7056
-1630
No files matched your search
@@ -0,0 +1,137 @@
|
||||
@tool
|
||||
extends Node2D
|
||||
class_name AshenVista
|
||||
|
||||
## Fondos pintados en planos independientes. Solo reconstruye la presentacion
|
||||
## al editar recursos; Parallax2D se ocupa del desplazamiento durante la partida.
|
||||
## Cada panorama alterna normal/reflejado para cerrar su union sin estirarlo.
|
||||
|
||||
@export_category("Painted layers")
|
||||
@export var distant_texture: Texture2D:
|
||||
set(value):
|
||||
distant_texture = value
|
||||
_queue_refresh()
|
||||
@export var middle_texture: Texture2D:
|
||||
set(value):
|
||||
middle_texture = value
|
||||
_queue_refresh()
|
||||
@export var near_texture: Texture2D:
|
||||
set(value):
|
||||
near_texture = value
|
||||
_queue_refresh()
|
||||
|
||||
@export_category("Composition")
|
||||
@export var horizon_y: float = 1008.0:
|
||||
set(value):
|
||||
horizon_y = value
|
||||
_queue_refresh()
|
||||
## Altura de referencia para componer el panorama tambien en el editor.
|
||||
@export var camera_anchor_y: float = 760.0:
|
||||
set(value):
|
||||
camera_anchor_y = value
|
||||
_queue_refresh()
|
||||
@export var composition_x: float = 0.0:
|
||||
set(value):
|
||||
composition_x = value
|
||||
_queue_refresh()
|
||||
@export_range(0.1, 2.0, 0.05) var distant_scale: float = 0.5:
|
||||
set(value):
|
||||
distant_scale = maxf(value, 0.1)
|
||||
_queue_refresh()
|
||||
@export_range(0.1, 2.0, 0.05) var middle_scale: float = 0.5:
|
||||
set(value):
|
||||
middle_scale = maxf(value, 0.1)
|
||||
_queue_refresh()
|
||||
@export_range(0.1, 2.0, 0.05) var near_scale: float = 0.5:
|
||||
set(value):
|
||||
near_scale = maxf(value, 0.1)
|
||||
_queue_refresh()
|
||||
@export var distant_tint: Color = Color.WHITE:
|
||||
set(value):
|
||||
distant_tint = value
|
||||
_queue_refresh()
|
||||
@export var middle_tint: Color = Color(0.60, 0.65, 0.74, 1.0):
|
||||
set(value):
|
||||
middle_tint = value
|
||||
_queue_refresh()
|
||||
@export var near_tint: Color = Color(0.44, 0.42, 0.44, 1.0):
|
||||
set(value):
|
||||
near_tint = value
|
||||
_queue_refresh()
|
||||
|
||||
var _refresh_pending: bool = false
|
||||
var _last_camera_y: float = INF
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_refresh()
|
||||
set_process(not Engine.is_editor_hint())
|
||||
|
||||
|
||||
func _queue_refresh() -> void:
|
||||
if not is_inside_tree() or _refresh_pending:
|
||||
return
|
||||
_refresh_pending = true
|
||||
call_deferred("_refresh")
|
||||
|
||||
|
||||
func _refresh() -> void:
|
||||
_refresh_pending = false
|
||||
if not is_inside_tree() or not has_node("Distant"):
|
||||
return
|
||||
_configure_layer($Distant, distant_texture, distant_scale, 0.12, distant_tint, 0.0)
|
||||
_configure_layer($Middle, middle_texture, middle_scale, 0.34, middle_tint, 24.0)
|
||||
_configure_layer($Near, near_texture, near_scale, 0.63, near_tint, -120.0)
|
||||
_last_camera_y = INF
|
||||
update_configuration_warnings()
|
||||
|
||||
|
||||
func _configure_layer(layer: Parallax2D, texture: Texture2D, factor: float,
|
||||
speed: float, tint: Color, base_offset: float) -> void:
|
||||
layer.visible = texture != null
|
||||
if texture == null:
|
||||
return
|
||||
var width: float = texture.get_width() * factor
|
||||
var height: float = texture.get_height() * factor
|
||||
# La vertical sigue al mundo: los fondos no se separan de los pies al saltar.
|
||||
layer.scroll_scale = Vector2(speed, 1.0)
|
||||
layer.repeat_size = Vector2(width * 2.0, 0.0)
|
||||
layer.repeat_times = 3
|
||||
for index: int in range(2):
|
||||
var panel: Sprite2D = layer.get_child(index) as Sprite2D
|
||||
panel.texture = texture
|
||||
panel.scale = Vector2(factor, factor)
|
||||
panel.position = Vector2(index * width + composition_x, horizon_y - height + base_offset)
|
||||
panel.modulate = tint
|
||||
panel.flip_h = index == 1
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
var camera: Camera2D = get_viewport().get_camera_2d()
|
||||
if camera == null:
|
||||
return
|
||||
var camera_y: float = camera.get_screen_center_position().y
|
||||
if is_equal_approx(camera_y, _last_camera_y):
|
||||
return
|
||||
_last_camera_y = camera_y
|
||||
# El cielo acompana el ascenso; las siluetas cercanas cambian ligeramente de
|
||||
# altura. Solo se mueven sprites almacenados, no se reconstruye el dibujo.
|
||||
_position_vertical($Distant, distant_texture, distant_scale, 0.0, 0.0, camera_y)
|
||||
_position_vertical($Middle, middle_texture, middle_scale, 24.0, 0.12, camera_y)
|
||||
_position_vertical($Near, near_texture, near_scale, -120.0, 0.22, camera_y)
|
||||
|
||||
|
||||
func _position_vertical(layer: Parallax2D, texture: Texture2D, factor: float,
|
||||
base_offset: float, ratio: float, camera_y: float) -> void:
|
||||
if texture == null:
|
||||
return
|
||||
var y: float = horizon_y - texture.get_height() * factor + base_offset
|
||||
y += (camera_y - camera_anchor_y) * (1.0 - ratio)
|
||||
for panel: Sprite2D in layer.get_children():
|
||||
panel.position.y = roundf(y)
|
||||
|
||||
|
||||
func _get_configuration_warnings() -> PackedStringArray:
|
||||
if distant_texture == null:
|
||||
return PackedStringArray(["Asigna el panorama lejano de la localizacion."])
|
||||
return PackedStringArray()
|
||||
Reference in new issue
Block a user