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,35 @@
|
||||
extends CanvasLayer
|
||||
class_name AshenAtmosphere
|
||||
|
||||
## Una capa ambiental para toda la ventana; no depende de la longitud del nivel.
|
||||
## Polvo por CPU y una sola pasada de niebla, sin leer la pantalla ni luces globales.
|
||||
|
||||
@export var mist_strength: float = 0.45
|
||||
@export var mist_color: Color = Color(0.40, 0.39, 0.46, 0.14)
|
||||
@export var dust_color: Color = Color(0.72, 0.60, 0.45, 0.38)
|
||||
|
||||
var _clock: float = 0.0
|
||||
var _mist_material: ShaderMaterial
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_mist_material = ($Mist as ColorRect).material.duplicate() as ShaderMaterial
|
||||
($Mist as ColorRect).material = _mist_material
|
||||
_mist_material.set_shader_parameter("strength", mist_strength)
|
||||
_mist_material.set_shader_parameter("mist_color", mist_color)
|
||||
($Dust as CPUParticles2D).color = dust_color
|
||||
get_viewport().size_changed.connect(_resize)
|
||||
_resize()
|
||||
|
||||
|
||||
func _resize() -> void:
|
||||
var viewport_size: Vector2 = get_viewport().get_visible_rect().size
|
||||
($Mist as ColorRect).size = viewport_size
|
||||
var dust: CPUParticles2D = $Dust
|
||||
dust.position = viewport_size * 0.5
|
||||
dust.emission_rect_extents = viewport_size * 0.55
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
_clock = fmod(_clock + delta, 10000.0)
|
||||
_mist_material.set_shader_parameter("clock", _clock)
|
||||
@@ -0,0 +1,27 @@
|
||||
shader_type canvas_item;
|
||||
render_mode unshaded;
|
||||
|
||||
uniform float clock = 0.0;
|
||||
uniform vec4 mist_color : source_color = vec4(0.40, 0.39, 0.46, 0.14);
|
||||
uniform float strength : hint_range(0.0, 1.0) = 0.45;
|
||||
|
||||
float soft_noise(vec2 p) {
|
||||
vec2 i = floor(p);
|
||||
vec2 f = fract(p);
|
||||
f = f * f * (3.0 - 2.0 * f);
|
||||
float a = fract(sin(dot(i, vec2(127.1, 311.7))) * 43758.5453);
|
||||
float b = fract(sin(dot(i + vec2(1.0, 0.0), vec2(127.1, 311.7))) * 43758.5453);
|
||||
float c = fract(sin(dot(i + vec2(0.0, 1.0), vec2(127.1, 311.7))) * 43758.5453);
|
||||
float d = fract(sin(dot(i + vec2(1.0, 1.0), vec2(127.1, 311.7))) * 43758.5453);
|
||||
return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
// Niebla tenue de baja frecuencia: nunca oculta bordes ni siluetas de combate.
|
||||
vec2 p = floor(UV * vec2(640.0, 360.0)) / vec2(640.0, 360.0);
|
||||
float bank = soft_noise(vec2(p.x * 4.0 - clock * 0.025, p.y * 2.7));
|
||||
float floor_mask = smoothstep(0.50, 0.96, p.y);
|
||||
float rim = smoothstep(0.38, 0.72, abs(p.x - 0.5));
|
||||
float opacity = (floor_mask * (0.26 + bank * 0.65) + rim * 0.12) * strength;
|
||||
COLOR = vec4(mist_color.rgb, mist_color.a * opacity);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
[gd_scene load_steps=6 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://world/backgrounds/ashen_atmosphere.gd" id="script"]
|
||||
[ext_resource type="Shader" path="res://world/backgrounds/ashen_atmosphere.gdshader" id="shader"]
|
||||
[ext_resource type="Script" path="res://ui/editor_ui_visibility.gd" id="editor"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="mist"]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource("shader")
|
||||
|
||||
[sub_resource type="Gradient" id="fade"]
|
||||
offsets = PackedFloat32Array(0, 0.15, 0.75, 1)
|
||||
colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 0.8, 1, 1, 1, 0.5, 1, 1, 1, 0)
|
||||
|
||||
[node name="AshenAtmosphere" type="CanvasLayer"]
|
||||
layer = 70
|
||||
script = ExtResource("script")
|
||||
|
||||
[node name="EditorVisibility" type="Node" parent="."]
|
||||
script = ExtResource("editor")
|
||||
|
||||
[node name="Mist" type="ColorRect" parent="."]
|
||||
material = SubResource("mist")
|
||||
mouse_filter = 2
|
||||
color = Color(1, 1, 1, 1)
|
||||
|
||||
[node name="Dust" type="CPUParticles2D" parent="."]
|
||||
amount = 36
|
||||
lifetime = 12.0
|
||||
preprocess = 12.0
|
||||
randomness = 0.65
|
||||
emission_shape = 3
|
||||
emission_rect_extents = Vector2(704, 396)
|
||||
direction = Vector2(0.35, -1)
|
||||
spread = 18.0
|
||||
gravity = Vector2(0, 0)
|
||||
initial_velocity_min = 3.0
|
||||
initial_velocity_max = 8.0
|
||||
scale_amount_min = 1.0
|
||||
scale_amount_max = 2.0
|
||||
color = Color(0.72, 0.60, 0.45, 0.38)
|
||||
color_ramp = SubResource("fade")
|
||||
@@ -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()
|
||||
@@ -1,52 +1,52 @@
|
||||
[gd_scene load_steps=5 format=3]
|
||||
[ext_resource type="Texture2D" path="res://assets/city/sky.png" id="art_sky"]
|
||||
[ext_resource type="Texture2D" path="res://assets/city/clouds.png" id="art_clouds"]
|
||||
[ext_resource type="Texture2D" path="res://assets/city/skyline_far.png" id="art_skyline_far"]
|
||||
[ext_resource type="Texture2D" path="res://assets/city/skyline_mid.png" id="art_skyline_mid"]
|
||||
|
||||
[ext_resource type="Script" path="res://world/backgrounds/ashen_vista.gd" id="script"]
|
||||
[ext_resource type="Texture2D" path="res://assets/ashen/environment/city_far.png" id="far"]
|
||||
[ext_resource type="Texture2D" path="res://assets/ashen/environment/city_mid.png" id="mid"]
|
||||
[ext_resource type="Texture2D" path="res://assets/ashen/environment/near_ruins.png" id="near"]
|
||||
|
||||
[node name="CityBackground" type="Node2D"]
|
||||
|
||||
[node name="Sky" type="Parallax2D" parent="."]
|
||||
z_index = -18
|
||||
scroll_scale = Vector2(0, 1)
|
||||
repeat_size = Vector2(1024, 0)
|
||||
repeat_times = 2
|
||||
|
||||
[node name="Strip" type="Sprite2D" parent="Sky"]
|
||||
centered = false
|
||||
texture_filter = 1
|
||||
texture = ExtResource("art_sky")
|
||||
script = ExtResource("script")
|
||||
distant_texture = ExtResource("far")
|
||||
middle_texture = ExtResource("mid")
|
||||
near_texture = ExtResource("near")
|
||||
|
||||
[node name="HighClouds" type="Parallax2D" parent="."]
|
||||
z_index = -17
|
||||
[node name="SkyTone" type="Polygon2D" parent="."]
|
||||
z_index = -40
|
||||
color = Color(0.14, 0.10, 0.15, 1)
|
||||
polygon = PackedVector2Array(-20000, -12000, 40000, -12000, 40000, 12000, -20000, 12000)
|
||||
|
||||
[node name="Distant" type="Parallax2D" parent="."]
|
||||
z_index = -30
|
||||
scroll_scale = Vector2(0.12, 1)
|
||||
repeat_size = Vector2(1024, 0)
|
||||
repeat_times = 2
|
||||
autoscroll = Vector2(3, 0)
|
||||
repeat_size = Vector2(1774, 0)
|
||||
repeat_times = 3
|
||||
|
||||
[node name="Strip" type="Sprite2D" parent="HighClouds"]
|
||||
[node name="Normal" type="Sprite2D" parent="Distant"]
|
||||
centered = false
|
||||
texture_filter = 1
|
||||
texture = ExtResource("art_clouds")
|
||||
|
||||
[node name="FarBuildings" type="Parallax2D" parent="."]
|
||||
z_index = -16
|
||||
scroll_scale = Vector2(0.23, 1)
|
||||
repeat_size = Vector2(1024, 0)
|
||||
repeat_times = 2
|
||||
|
||||
[node name="Strip" type="Sprite2D" parent="FarBuildings"]
|
||||
[node name="Mirrored" type="Sprite2D" parent="Distant"]
|
||||
centered = false
|
||||
texture_filter = 1
|
||||
texture = ExtResource("art_skyline_far")
|
||||
|
||||
[node name="NearBuildings" type="Parallax2D" parent="."]
|
||||
z_index = -15
|
||||
scroll_scale = Vector2(0.46, 1)
|
||||
repeat_size = Vector2(1024, 0)
|
||||
repeat_times = 2
|
||||
[node name="Middle" type="Parallax2D" parent="."]
|
||||
z_index = -24
|
||||
scroll_scale = Vector2(0.34, 1)
|
||||
repeat_times = 3
|
||||
|
||||
[node name="Strip" type="Sprite2D" parent="NearBuildings"]
|
||||
[node name="Normal" type="Sprite2D" parent="Middle"]
|
||||
centered = false
|
||||
|
||||
[node name="Mirrored" type="Sprite2D" parent="Middle"]
|
||||
centered = false
|
||||
|
||||
[node name="Near" type="Parallax2D" parent="."]
|
||||
z_index = -18
|
||||
scroll_scale = Vector2(0.63, 1)
|
||||
repeat_times = 3
|
||||
|
||||
[node name="Normal" type="Sprite2D" parent="Near"]
|
||||
centered = false
|
||||
|
||||
[node name="Mirrored" type="Sprite2D" parent="Near"]
|
||||
centered = false
|
||||
texture_filter = 1
|
||||
texture = ExtResource("art_skyline_mid")
|
||||
@@ -0,0 +1,58 @@
|
||||
@tool
|
||||
extends TextureRect
|
||||
class_name PaintedHall
|
||||
|
||||
## Mural con profundidad real dentro de los limites de una sala. La camara
|
||||
## recorre una pintura grande lentamente; columnas y plataformas siguen al mundo.
|
||||
## No se estira una ilustracion sobre toda la altura de una torre.
|
||||
const HALL_SHADER: Shader = preload("res://world/backgrounds/painted_hall.gdshader")
|
||||
|
||||
@export var parallax_ratio: Vector2 = Vector2(0.24, 0.18):
|
||||
set(value):
|
||||
parallax_ratio = value
|
||||
_update_layout()
|
||||
@export var composition_offset: Vector2 = Vector2(0.0, 160.0):
|
||||
set(value):
|
||||
composition_offset = value
|
||||
_update_layout()
|
||||
@export_range(0.25, 2.0, 0.05) var art_scale: float = 1.0:
|
||||
set(value):
|
||||
art_scale = maxf(value, 0.25)
|
||||
_update_layout()
|
||||
|
||||
var _hall_material: ShaderMaterial
|
||||
var _last_camera_local: Vector2 = Vector2.INF
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST
|
||||
expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
||||
_hall_material = ShaderMaterial.new()
|
||||
_hall_material.shader = HALL_SHADER
|
||||
material = _hall_material
|
||||
resized.connect(_update_layout)
|
||||
_update_layout()
|
||||
if Engine.is_editor_hint():
|
||||
_hall_material.set_shader_parameter("camera_local", size * 0.5)
|
||||
set_process(false)
|
||||
|
||||
|
||||
func _update_layout() -> void:
|
||||
if _hall_material == null:
|
||||
return
|
||||
_hall_material.set_shader_parameter("panel_size", size)
|
||||
_hall_material.set_shader_parameter("parallax_ratio", parallax_ratio)
|
||||
_hall_material.set_shader_parameter("composition_offset", composition_offset)
|
||||
_hall_material.set_shader_parameter("art_scale", art_scale)
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
var camera: Camera2D = get_viewport().get_camera_2d()
|
||||
if camera == null:
|
||||
return
|
||||
var local_position: Vector2 = get_global_transform().affine_inverse() * camera.get_screen_center_position()
|
||||
if local_position.is_equal_approx(_last_camera_local):
|
||||
return
|
||||
_last_camera_local = local_position
|
||||
_hall_material.set_shader_parameter("camera_local", local_position)
|
||||
@@ -0,0 +1,23 @@
|
||||
shader_type canvas_item;
|
||||
render_mode unshaded;
|
||||
|
||||
uniform vec2 panel_size = vec2(1280.0, 720.0);
|
||||
uniform vec2 camera_local = vec2(640.0, 360.0);
|
||||
uniform vec2 parallax_ratio = vec2(0.24, 0.18);
|
||||
uniform vec2 composition_offset = vec2(0.0, 160.0);
|
||||
uniform float art_scale = 1.0;
|
||||
varying vec4 vertex_tint;
|
||||
|
||||
void vertex() {
|
||||
vertex_tint = COLOR;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec2 art_size = vec2(textureSize(TEXTURE, 0)) * art_scale;
|
||||
vec2 p = UV * panel_size + camera_local * (parallax_ratio - vec2(1.0)) + composition_offset;
|
||||
vec2 uv = p / art_size;
|
||||
float mirrored = mod(floor(uv.x), 2.0);
|
||||
uv.x = mix(fract(uv.x), 1.0 - fract(uv.x), mirrored);
|
||||
uv.y = clamp(uv.y, 0.001, 0.999);
|
||||
COLOR = texture(TEXTURE, uv) * vertex_tint;
|
||||
}
|
||||
Reference in new issue
Block a user