Animaciones
This commit is contained in:
1 parent
b365c79251
commit
8a5290c5ef
10 files changed
+1581
-288
No files matched your search
+75
-2
@@ -1,10 +1,83 @@
|
||||
extends Camera2D
|
||||
|
||||
## Set to zero to disable camera shake and screen overlays.
|
||||
@export_range(0.0, 1.0, 0.05) var feedback_strength: float = 1.0
|
||||
|
||||
var _base_offset: Vector2
|
||||
var _shake_remaining: float = 0.0
|
||||
var _shake_duration: float = 0.16
|
||||
var _shake_amplitude: float = 0.0
|
||||
var _clock: float = 0.0
|
||||
var _solo_remaining: float = 0.0
|
||||
var _flash_color := Color(1.0, 0.82, 0.50)
|
||||
var _overlay: Control
|
||||
|
||||
|
||||
## Límites provisionales de cámara para la sala de pruebas actual.
|
||||
## Cuando existan niveles reales, estos límites podrán configurarse por nivel.
|
||||
func _ready() -> void:
|
||||
limit_left = 0
|
||||
limit_top = 0
|
||||
limit_right = 4000
|
||||
limit_bottom = 2500
|
||||
_base_offset = offset
|
||||
|
||||
# Below the existing HUDs. This Control never intercepts touch controls.
|
||||
var layer := CanvasLayer.new()
|
||||
layer.name = "CombatFeedback"
|
||||
layer.layer = 80
|
||||
add_child(layer)
|
||||
_overlay = Control.new()
|
||||
_overlay.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
layer.add_child(_overlay)
|
||||
_overlay.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
_overlay.draw.connect(_draw_feedback)
|
||||
|
||||
|
||||
func impact(strength: float = 1.5, duration: float = 0.16,
|
||||
color: Color = Color(1.0, 0.82, 0.50)) -> void:
|
||||
_shake_amplitude = maxf(_shake_amplitude, strength)
|
||||
_shake_remaining = maxf(_shake_remaining, duration)
|
||||
_shake_duration = maxf(_shake_remaining, 0.01)
|
||||
_flash_color = color
|
||||
|
||||
|
||||
func start_solo(duration: float) -> void:
|
||||
_solo_remaining = duration
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
_clock += delta
|
||||
_shake_remaining = maxf(0.0, _shake_remaining - delta)
|
||||
_solo_remaining = maxf(0.0, _solo_remaining - delta)
|
||||
var envelope: float = _shake_remaining / _shake_duration
|
||||
var amplitude: float = minf(_shake_amplitude, 3.0) * envelope * envelope * feedback_strength
|
||||
offset = _base_offset + Vector2(sin(_clock * 83.0), cos(_clock * 67.0)) * amplitude
|
||||
if _shake_remaining == 0.0:
|
||||
_shake_amplitude = 0.0
|
||||
_overlay.queue_redraw()
|
||||
|
||||
|
||||
func _draw_feedback() -> void:
|
||||
if feedback_strength <= 0.0:
|
||||
return
|
||||
var size: Vector2 = get_viewport_rect().size
|
||||
var pulse: float = (_shake_remaining / _shake_duration) * feedback_strength
|
||||
# Subtle edge flashes, not full-white flashes or a strobing screen.
|
||||
if pulse > 0.0:
|
||||
var color: Color = _flash_color
|
||||
color.a = pulse * 0.14
|
||||
_overlay.draw_rect(Rect2(0, 0, size.x, 8), color)
|
||||
_overlay.draw_rect(Rect2(0, size.y - 8, size.x, 8), color)
|
||||
_overlay.draw_rect(Rect2(0, 0, 8, size.y), color)
|
||||
_overlay.draw_rect(Rect2(size.x - 8, 0, 8, size.y), color)
|
||||
if _solo_remaining <= 0.0:
|
||||
return
|
||||
var solo_alpha: float = minf(_solo_remaining / 0.25, 1.0) * feedback_strength
|
||||
_overlay.draw_rect(Rect2(Vector2.ZERO, size), Color(0.18, 0.08, 0.32, 0.07 * solo_alpha))
|
||||
for side: float in [-1.0, 1.0]:
|
||||
var edge_x: float = 0.0 if side > 0.0 else size.x
|
||||
for index: int in range(7):
|
||||
var y: float = (float(index) + 0.5) * size.y / 7.0
|
||||
var length: float = (32.0 + float(index % 3) * 19.0) * (0.7 + pulse)
|
||||
var start := Vector2(edge_x, y)
|
||||
var end := Vector2(edge_x + side * length, lerpf(y, size.y * 0.5, 0.1))
|
||||
_overlay.draw_line(start, end, Color(0.66, 0.85, 1.0, 0.24 * solo_alpha), 3.0)
|
||||
@@ -1,248 +1,306 @@
|
||||
[gd_resource type="SpriteFrames" format=3 uid="uid://s2xmt6mpri5c"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cjxrw1p7eh82i" path="res://assets/characters/ankarde/Diego-idle-trimmed.png" id="1_idle"]
|
||||
[ext_resource type="Texture2D" uid="uid://dg1x17ci14p4f" path="res://assets/characters/ankarde/Diego-walk-trimmed.png" id="2_walk"]
|
||||
[ext_resource type="Texture2D" path="res://assets/characters/ankarde/player_pixel.svg" id="1_pixel"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_lquwl"]
|
||||
atlas = ExtResource("1_idle")
|
||||
region = Rect2(0, 0, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="idle_0"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(0, 0, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_7mycd"]
|
||||
atlas = ExtResource("1_idle")
|
||||
region = Rect2(256, 0, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="idle_1"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(64, 0, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_272bh"]
|
||||
atlas = ExtResource("1_idle")
|
||||
region = Rect2(512, 0, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="idle_2"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(128, 0, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_5vw27"]
|
||||
atlas = ExtResource("1_idle")
|
||||
region = Rect2(768, 0, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="idle_3"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(192, 0, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_kek77"]
|
||||
atlas = ExtResource("1_idle")
|
||||
region = Rect2(1024, 0, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="walk_0"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(256, 0, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4c57u"]
|
||||
atlas = ExtResource("1_idle")
|
||||
region = Rect2(0, 256, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="walk_1"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(320, 0, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_efxa6"]
|
||||
atlas = ExtResource("1_idle")
|
||||
region = Rect2(256, 256, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="walk_2"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(384, 0, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dg77c"]
|
||||
atlas = ExtResource("1_idle")
|
||||
region = Rect2(512, 256, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="walk_3"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(448, 0, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ycdy4"]
|
||||
atlas = ExtResource("1_idle")
|
||||
region = Rect2(768, 256, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="walk_4"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(0, 64, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_w48qg"]
|
||||
atlas = ExtResource("1_idle")
|
||||
region = Rect2(1024, 256, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="walk_5"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(64, 64, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vivmo"]
|
||||
atlas = ExtResource("1_idle")
|
||||
region = Rect2(0, 512, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="jump_0"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(128, 64, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2cqfq"]
|
||||
atlas = ExtResource("1_idle")
|
||||
region = Rect2(256, 512, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="jump_1"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(192, 64, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yaehf"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(0, 0, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="fall_0"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(256, 64, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_074og"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(256, 0, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="fall_1"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(320, 64, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_cegan"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(512, 0, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="punch_0"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(384, 64, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_82xsv"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(768, 0, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="punch_1"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(448, 64, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_getpj"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(1024, 0, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="punch_2"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(0, 128, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ryguw"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(0, 256, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="punch_3"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(64, 128, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_d13ii"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(256, 256, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="punch_4"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(128, 128, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1u8w0"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(512, 256, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="ground_pound_0"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(192, 128, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0odxb"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(768, 256, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="ground_pound_1"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(256, 128, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_lswn8"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(1024, 256, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="land_0"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(320, 128, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_a6jrf"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(0, 512, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="land_1"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(384, 128, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xuqvo"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(256, 512, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="land_2"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(448, 128, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qsp4k"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(512, 512, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="special_start_0"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(0, 192, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_kq58d"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(768, 512, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="special_start_1"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(64, 192, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_seu75"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(1024, 512, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="special_start_2"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(128, 192, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_htxhm"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(0, 768, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="special_0"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(192, 192, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jq2sk"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(256, 768, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="special_1"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(256, 192, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4k2k6"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(512, 768, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="special_2"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(320, 192, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0rl1p"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(768, 768, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="special_3"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(384, 192, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ok6jj"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(1024, 768, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="special_4"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(448, 192, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_facbu"]
|
||||
atlas = ExtResource("2_walk")
|
||||
region = Rect2(0, 1024, 256, 256)
|
||||
[sub_resource type="AtlasTexture" id="special_5"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(0, 256, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="special_end_0"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(64, 256, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="special_end_1"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(128, 256, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="hurt_0"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(192, 256, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="hurt_1"]
|
||||
atlas = ExtResource("1_pixel")
|
||||
region = Rect2(256, 256, 64, 64)
|
||||
filter_clip = true
|
||||
|
||||
[resource]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_lquwl")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_7mycd")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_272bh")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_5vw27")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_kek77")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4c57u")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_efxa6")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_dg77c")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ycdy4")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_w48qg")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_vivmo")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_2cqfq")
|
||||
}],
|
||||
"loop": 1,
|
||||
animations = [
|
||||
{
|
||||
"frames": [
|
||||
{"duration": 1.0, "texture": SubResource("idle_0")},
|
||||
{"duration": 1.0, "texture": SubResource("idle_1")},
|
||||
{"duration": 1.0, "texture": SubResource("idle_2")},
|
||||
{"duration": 1.0, "texture": SubResource("idle_3")}
|
||||
],
|
||||
"loop": true,
|
||||
"name": &"idle",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_yaehf")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_074og")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_cegan")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_82xsv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_getpj")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ryguw")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_d13ii")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_1u8w0")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_0odxb")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_lswn8")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_a6jrf")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_xuqvo")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qsp4k")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_kq58d")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_seu75")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_htxhm")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_jq2sk")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4k2k6")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_0rl1p")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ok6jj")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_facbu")
|
||||
}],
|
||||
"loop": 1,
|
||||
},
|
||||
{
|
||||
"frames": [
|
||||
{"duration": 1.0, "texture": SubResource("walk_0")},
|
||||
{"duration": 1.0, "texture": SubResource("walk_1")},
|
||||
{"duration": 1.0, "texture": SubResource("walk_2")},
|
||||
{"duration": 1.0, "texture": SubResource("walk_3")},
|
||||
{"duration": 1.0, "texture": SubResource("walk_4")},
|
||||
{"duration": 1.0, "texture": SubResource("walk_5")}
|
||||
],
|
||||
"loop": true,
|
||||
"name": &"walk",
|
||||
"speed": 5.0
|
||||
}]
|
||||
"speed": 10.0
|
||||
},
|
||||
{
|
||||
"frames": [
|
||||
{"duration": 1.0, "texture": SubResource("jump_0")},
|
||||
{"duration": 1.0, "texture": SubResource("jump_1")}
|
||||
],
|
||||
"loop": false,
|
||||
"name": &"jump",
|
||||
"speed": 9.0
|
||||
},
|
||||
{
|
||||
"frames": [
|
||||
{"duration": 1.0, "texture": SubResource("fall_0")},
|
||||
{"duration": 1.0, "texture": SubResource("fall_1")}
|
||||
],
|
||||
"loop": true,
|
||||
"name": &"fall",
|
||||
"speed": 7.0
|
||||
},
|
||||
{
|
||||
"frames": [
|
||||
{"duration": 1.0, "texture": SubResource("punch_0")},
|
||||
{"duration": 0.75, "texture": SubResource("punch_1")},
|
||||
{"duration": 1.15, "texture": SubResource("punch_2")},
|
||||
{"duration": 0.8, "texture": SubResource("punch_3")},
|
||||
{"duration": 1.3, "texture": SubResource("punch_4")}
|
||||
],
|
||||
"loop": false,
|
||||
"name": &"punch",
|
||||
"speed": 18.0
|
||||
},
|
||||
{
|
||||
"frames": [
|
||||
{"duration": 1.0, "texture": SubResource("ground_pound_0")},
|
||||
{"duration": 1.0, "texture": SubResource("ground_pound_1")}
|
||||
],
|
||||
"loop": true,
|
||||
"name": &"ground_pound",
|
||||
"speed": 12.0
|
||||
},
|
||||
{
|
||||
"frames": [
|
||||
{"duration": 1.0, "texture": SubResource("land_0")},
|
||||
{"duration": 1.0, "texture": SubResource("land_1")},
|
||||
{"duration": 1.0, "texture": SubResource("land_2")}
|
||||
],
|
||||
"loop": false,
|
||||
"name": &"land",
|
||||
"speed": 16.0
|
||||
},
|
||||
{
|
||||
"frames": [
|
||||
{"duration": 1.0, "texture": SubResource("special_start_0")},
|
||||
{"duration": 1.0, "texture": SubResource("special_start_1")},
|
||||
{"duration": 1.0, "texture": SubResource("special_start_2")}
|
||||
],
|
||||
"loop": false,
|
||||
"name": &"special_start",
|
||||
"speed": 9.0
|
||||
},
|
||||
{
|
||||
"frames": [
|
||||
{"duration": 1.0, "texture": SubResource("special_0")},
|
||||
{"duration": 1.0, "texture": SubResource("special_1")},
|
||||
{"duration": 1.0, "texture": SubResource("special_2")},
|
||||
{"duration": 1.0, "texture": SubResource("special_3")},
|
||||
{"duration": 1.0, "texture": SubResource("special_4")},
|
||||
{"duration": 1.0, "texture": SubResource("special_5")}
|
||||
],
|
||||
"loop": true,
|
||||
"name": &"special",
|
||||
"speed": 12.0
|
||||
},
|
||||
{
|
||||
"frames": [
|
||||
{"duration": 1.0, "texture": SubResource("special_end_0")},
|
||||
{"duration": 1.0, "texture": SubResource("special_end_1")}
|
||||
],
|
||||
"loop": false,
|
||||
"name": &"special_end",
|
||||
"speed": 7.0
|
||||
},
|
||||
{
|
||||
"frames": [
|
||||
{"duration": 1.0, "texture": SubResource("hurt_0")},
|
||||
{"duration": 1.0, "texture": SubResource("hurt_1")}
|
||||
],
|
||||
"loop": false,
|
||||
"name": &"hurt",
|
||||
"speed": 12.0
|
||||
}
|
||||
]
|
||||
+180
-64
@@ -17,6 +17,7 @@ signal pickup_collected(data: PickupData)
|
||||
# 4 -> player hurtbox
|
||||
# 5 -> enemy hurtbox
|
||||
const ENEMY_HURTBOX_MASK: int = 1 << 4
|
||||
const COMBAT_FX = preload("res://effects/combat_fx.gd")
|
||||
|
||||
|
||||
# ============================================================================
|
||||
@@ -103,10 +104,12 @@ const ENEMY_HURTBOX_MASK: int = 1 << 4
|
||||
|
||||
@export_category("Punch")
|
||||
|
||||
@export var punch_duration: float = 0.13
|
||||
@export var punch_cooldown: float = 0.28
|
||||
@export var punch_hitbox_size: Vector2 = Vector2(34.0, 24.0)
|
||||
@export var punch_offset: Vector2 = Vector2(30.0, 0.0)
|
||||
@export var punch_duration: float = 0.28
|
||||
@export var punch_windup: float = 0.055
|
||||
@export var punch_active_duration: float = 0.11
|
||||
@export var punch_cooldown: float = 0.34
|
||||
@export var punch_hitbox_size: Vector2 = Vector2(28.0, 22.0)
|
||||
@export var punch_offset: Vector2 = Vector2(28.0, -4.0)
|
||||
|
||||
|
||||
# ============================================================================
|
||||
@@ -125,7 +128,7 @@ const ENEMY_HURTBOX_MASK: int = 1 << 4
|
||||
@export_range(0.0, 1.0) var ground_pound_horizontal_control: float = 0.25
|
||||
|
||||
@export var ground_pound_radius: float = 54.0
|
||||
@export var ground_pound_offset: Vector2 = Vector2(0.0, 18.0)
|
||||
@export var ground_pound_offset: Vector2 = Vector2(0.0, 24.0)
|
||||
|
||||
## From 7 damage on a small jump to 12 on a high one; always stronger
|
||||
## than a standard 5-point punch, even without any pickup.
|
||||
@@ -156,6 +159,10 @@ const ENEMY_HURTBOX_MASK: int = 1 << 4
|
||||
## The Level 01 test sets a smaller radius to keep encounters independent.
|
||||
@export var special_radius: float = 100000.0
|
||||
|
||||
## Guitar draw, sustained solo, then recovery. Damage is shared by all pulses.
|
||||
@export_range(0.6, 6.0, 0.1) var special_duration: float = 2.4
|
||||
@export_range(1, 8, 1) var special_pulse_count: int = 4
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# DEBUG
|
||||
@@ -164,8 +171,8 @@ const ENEMY_HURTBOX_MASK: int = 1 << 4
|
||||
@export_category("Debug")
|
||||
|
||||
## Draws the actual hurtbox and attack areas used by gameplay.
|
||||
## It is deliberately enabled while the final animations do not exist.
|
||||
@export var show_debug_hitboxes: bool = true
|
||||
## Combat effects do not depend on this debug overlay.
|
||||
@export var show_debug_hitboxes: bool = false
|
||||
|
||||
## Keeps the ground-pound area visible briefly after impact.
|
||||
@export var debug_impact_duration: float = 0.18
|
||||
@@ -176,6 +183,7 @@ const ENEMY_HURTBOX_MASK: int = 1 << 4
|
||||
# ============================================================================
|
||||
|
||||
@onready var animated_sprite: AnimatedSprite2D = $AnimatedSprite2D
|
||||
@onready var feedback_camera: Camera2D = $Camera2D
|
||||
@onready var hurtbox_collision: CollisionShape2D = $Hurtbox/CollisionShape2D
|
||||
@onready var punch_hitbox: Area2D = $PunchHitbox
|
||||
@onready var punch_collision: CollisionShape2D = $PunchHitbox/CollisionShape2D
|
||||
@@ -230,6 +238,16 @@ var punch_hit_targets: Dictionary = {}
|
||||
|
||||
var special_charge: int = 0
|
||||
|
||||
var _special_active: bool = false
|
||||
var _special_elapsed: float = 0.0
|
||||
var _special_charge_used: int = 0
|
||||
var _special_pulses_sent: int = 0
|
||||
var _special_damage_budgets: Dictionary = {}
|
||||
var _special_damage_dealt: Dictionary = {}
|
||||
var _hurt_animation_timer: float = 0.0
|
||||
var _landing_animation_timer: float = 0.0
|
||||
var _punch_swing_shown: bool = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if character_data == null:
|
||||
@@ -286,8 +304,13 @@ func _physics_process(delta: float) -> void:
|
||||
jumps_remaining = max_jumps
|
||||
if ground_pound_active:
|
||||
_ground_pound_impact()
|
||||
else:
|
||||
_landing_animation_timer = 0.18
|
||||
COMBAT_FX.spawn(get_parent(), global_position + Vector2(0, 26), &"dust")
|
||||
|
||||
_update_special_attack(delta)
|
||||
_update_animation()
|
||||
_update_visual_feedback()
|
||||
queue_redraw()
|
||||
|
||||
|
||||
@@ -296,9 +319,14 @@ func _physics_process(delta: float) -> void:
|
||||
# ============================================================================
|
||||
|
||||
func _handle_horizontal_movement(delta: float) -> void:
|
||||
# Let impulses decay instead of immediately overwriting them with input.
|
||||
if _special_active or _hurt_animation_timer > 0.0:
|
||||
var braking: float = 110.0 if _special_active else 550.0
|
||||
velocity.x = move_toward(velocity.x, 0.0, braking * delta)
|
||||
return
|
||||
var direction: float = Input.get_axis("move_left", "move_right")
|
||||
|
||||
if direction != 0.0:
|
||||
if direction != 0.0 and punch_timer <= 0.0:
|
||||
facing_direction = signf(direction)
|
||||
_update_facing()
|
||||
|
||||
@@ -385,6 +413,8 @@ func _update_jump_windows(delta: float) -> void:
|
||||
|
||||
|
||||
func _handle_jump() -> void:
|
||||
if _special_active or _hurt_animation_timer > 0.0:
|
||||
return
|
||||
if (
|
||||
jump_buffer_timer > 0.0
|
||||
and not ground_pound_active
|
||||
@@ -408,6 +438,8 @@ func _handle_jump() -> void:
|
||||
# ============================================================================
|
||||
|
||||
func _handle_attack_input() -> void:
|
||||
if _special_active or _hurt_animation_timer > 0.0:
|
||||
return
|
||||
if Input.is_action_just_pressed("attack"):
|
||||
_start_punch()
|
||||
return
|
||||
@@ -429,14 +461,23 @@ func _handle_attack_input() -> void:
|
||||
# ============================================================================
|
||||
|
||||
func _start_punch() -> void:
|
||||
if is_dead or _special_active or ground_pound_active or attack_cooldown_timer > 0.0:
|
||||
return
|
||||
punch_timer = punch_duration
|
||||
attack_cooldown_timer = punch_cooldown
|
||||
attack_cooldown_timer = maxf(punch_cooldown, punch_duration)
|
||||
_punch_swing_shown = false
|
||||
punch_hit_targets.clear()
|
||||
|
||||
|
||||
func _update_punch_damage() -> void:
|
||||
if punch_timer <= 0.0:
|
||||
return
|
||||
var elapsed: float = punch_duration - punch_timer
|
||||
if elapsed < punch_windup or elapsed > punch_windup + punch_active_duration:
|
||||
return
|
||||
if not _punch_swing_shown:
|
||||
_punch_swing_shown = true
|
||||
COMBAT_FX.spawn(get_parent(), punch_hitbox.global_position, &"swing", facing_direction)
|
||||
|
||||
for area in punch_hitbox.get_overlapping_areas():
|
||||
_damage_target(area, roundi(character_data.basic_attack_damage * (1.0 + _damage_boost_multiplier)), punch_hit_targets)
|
||||
@@ -447,9 +488,10 @@ func _update_punch_damage() -> void:
|
||||
# ============================================================================
|
||||
|
||||
func _start_ground_pound() -> void:
|
||||
if ground_pound_active:
|
||||
if is_dead or _special_active or ground_pound_active:
|
||||
return
|
||||
|
||||
punch_timer = 0.0
|
||||
ground_pound_active = true
|
||||
attack_cooldown_timer = punch_cooldown
|
||||
|
||||
@@ -461,6 +503,10 @@ func _start_ground_pound() -> void:
|
||||
func _ground_pound_impact() -> void:
|
||||
ground_pound_active = false
|
||||
ground_pound_debug_timer = debug_impact_duration
|
||||
_landing_animation_timer = 0.20
|
||||
COMBAT_FX.spawn(get_parent(), global_position + Vector2(0, 26),
|
||||
&"ground_pound", facing_direction, ground_pound_radius)
|
||||
feedback_camera.call("impact", 2.8, 0.24)
|
||||
|
||||
# Damage scales with jump height: how high the player rose from the takeoff
|
||||
# point, clamped between the min and max damage.
|
||||
@@ -482,8 +528,15 @@ func _ground_pound_impact() -> void:
|
||||
roundi(damage * (1.0 + _damage_boost_multiplier + _air_damage_boost_multiplier)),
|
||||
ground_pound_max_damage
|
||||
)
|
||||
for area in ground_pound_hitbox.get_overlapping_areas():
|
||||
_damage_target(area, final_damage, hit_targets)
|
||||
# Query at the resolved landing position, not last frame's cached overlaps.
|
||||
var query := PhysicsShapeQueryParameters2D.new()
|
||||
query.shape = ground_pound_collision.shape
|
||||
query.transform = ground_pound_collision.global_transform
|
||||
query.collision_mask = ENEMY_HURTBOX_MASK
|
||||
query.collide_with_areas = true
|
||||
query.collide_with_bodies = false
|
||||
for hit: Dictionary in get_world_2d().direct_space_state.intersect_shape(query, 64):
|
||||
_damage_target(hit["collider"], final_damage, hit_targets)
|
||||
|
||||
|
||||
# ============================================================================
|
||||
@@ -491,59 +544,77 @@ func _ground_pound_impact() -> void:
|
||||
# ============================================================================
|
||||
|
||||
func _start_special_attack() -> void:
|
||||
if is_dead:
|
||||
if is_dead or _special_active or ground_pound_active or special_max_charge <= 0:
|
||||
return
|
||||
if special_charge <= 0 or special_charge < special_min_use_charge:
|
||||
return
|
||||
|
||||
if special_charge < special_min_use_charge:
|
||||
return
|
||||
|
||||
var charge_used: int = special_charge
|
||||
# Consume all current charge
|
||||
_special_charge_used = special_charge
|
||||
special_charge = 0
|
||||
special_charge_changed.emit(special_charge, special_max_charge)
|
||||
|
||||
_apply_special_attack(charge_used)
|
||||
_special_active = true
|
||||
_special_elapsed = 0.0
|
||||
_special_pulses_sent = 0
|
||||
_special_damage_budgets.clear()
|
||||
_special_damage_dealt.clear()
|
||||
punch_timer = 0.0
|
||||
velocity.x = 0.0
|
||||
feedback_camera.call("start_solo", special_duration)
|
||||
_spawn_floating_text("GUITAR SOLO!", Color(0.76, 0.85, 1.0))
|
||||
|
||||
|
||||
func _apply_special_attack(charge_used: int = special_max_charge) -> void:
|
||||
var charge_ratio: float = clamp(float(charge_used) / float(special_max_charge), 0.0, 1.0)
|
||||
func _update_special_attack(delta: float) -> void:
|
||||
if not _special_active:
|
||||
return
|
||||
_special_elapsed += delta
|
||||
var pulse_count: int = maxi(special_pulse_count, 1)
|
||||
var windup: float = special_duration * 0.15
|
||||
var interval: float = special_duration * 0.65 / float(maxi(pulse_count - 1, 1))
|
||||
# Catch up when a long frame spans a pulse, without replaying previous pulses.
|
||||
while _special_pulses_sent < pulse_count:
|
||||
if _special_elapsed < windup + interval * float(_special_pulses_sent):
|
||||
break
|
||||
_apply_special_attack(_special_charge_used, _special_pulses_sent)
|
||||
_special_pulses_sent += 1
|
||||
var effect_radius: float = minf(special_radius, 300.0) if special_radius > 0.0 else 300.0
|
||||
COMBAT_FX.spawn(get_parent(), global_position, &"solo", facing_direction, effect_radius)
|
||||
feedback_camera.call("impact", 2.0, 0.18, Color(0.61, 0.82, 1.0))
|
||||
velocity.x = -facing_direction * 35.0
|
||||
if _special_elapsed >= special_duration:
|
||||
_special_active = false
|
||||
_special_damage_budgets.clear()
|
||||
_special_damage_dealt.clear()
|
||||
|
||||
var hit_targets: Dictionary = {}
|
||||
|
||||
# Get viewport size to scale falloff across the whole screen
|
||||
var viewport: Viewport = get_viewport()
|
||||
var viewport_rect: Rect2 = viewport.get_visible_rect()
|
||||
var max_distance: float = max(viewport_rect.size.x, viewport_rect.size.y) * 0.8
|
||||
if max_distance < 1.0:
|
||||
max_distance = special_radius
|
||||
func _apply_special_attack(charge_used: int, pulse_index: int = 0) -> void:
|
||||
var charge_ratio: float = clampf(float(charge_used) / float(maxi(special_max_charge, 1)), 0.0, 1.0)
|
||||
var viewport_rect: Rect2 = get_viewport().get_visible_rect()
|
||||
var max_distance: float = maxf(maxf(viewport_rect.size.x, viewport_rect.size.y) * 0.8, 1.0)
|
||||
var pulse_count: int = maxi(special_pulse_count, 1)
|
||||
|
||||
for enemy in get_tree().get_nodes_in_group("enemy"):
|
||||
if not is_instance_valid(enemy):
|
||||
for node: Node in get_tree().get_nodes_in_group("enemy"):
|
||||
var enemy := node as Node2D
|
||||
if enemy == null or not enemy.has_method("take_damage") or bool(enemy.get("is_dead")):
|
||||
continue
|
||||
|
||||
if not enemy.has_method("take_damage"):
|
||||
continue
|
||||
|
||||
var distance: float = global_position.distance_to(enemy.global_position)
|
||||
if special_radius > 0.0 and distance > special_radius:
|
||||
continue
|
||||
# Damage falls off with distance: maximum at the player, lower farther away
|
||||
# affects the whole screen (no hard circle cutoff)
|
||||
var distance_factor: float = 1.0 - clamp(distance / max_distance, 0.0, 1.0)
|
||||
# Ensure it still affects even if very far, just minimal
|
||||
if distance_factor < 0.1:
|
||||
distance_factor = 0.1
|
||||
|
||||
var damage: int = int(special_max_damage * charge_ratio * distance_factor)
|
||||
if damage < 1:
|
||||
damage = 1
|
||||
|
||||
var enemy_id: int = enemy.get_instance_id()
|
||||
if hit_targets.has(enemy_id):
|
||||
# A screen attack should not silently damage enemies at the far end of the map.
|
||||
if not viewport_rect.grow(28.0).has_point(enemy.get_global_transform_with_canvas().origin):
|
||||
continue
|
||||
|
||||
hit_targets[enemy_id] = true
|
||||
enemy.take_damage(damage, global_position)
|
||||
var enemy_id: int = enemy.get_instance_id()
|
||||
if not _special_damage_budgets.has(enemy_id):
|
||||
var distance_factor: float = maxf(0.1, 1.0 - clampf(distance / max_distance, 0.0, 1.0))
|
||||
_special_damage_budgets[enemy_id] = maxi(1, int(special_max_damage * charge_ratio * distance_factor))
|
||||
# Freeze the budget on first contact: knockback must not change total damage.
|
||||
var total_damage: int = int(_special_damage_budgets[enemy_id])
|
||||
var cumulative_damage: int = ceili(float(total_damage) * float(pulse_index + 1) / float(pulse_count))
|
||||
var damage: int = cumulative_damage - int(_special_damage_dealt.get(enemy_id, 0))
|
||||
if damage <= 0:
|
||||
continue
|
||||
_special_damage_dealt[enemy_id] = cumulative_damage
|
||||
enemy.call("take_damage", damage, global_position)
|
||||
|
||||
|
||||
func collect_pickup(data: PickupData) -> bool:
|
||||
@@ -627,7 +698,7 @@ func _connect_to_enemies() -> void:
|
||||
enemy.connect(&"died", _on_enemy_died.bind(enemy))
|
||||
|
||||
|
||||
func _on_enemy_died(enemy: Node) -> void:
|
||||
func _on_enemy_died(_enemy: Node) -> void:
|
||||
if is_dead:
|
||||
return
|
||||
|
||||
@@ -682,6 +753,11 @@ func take_damage(amount: int, source_position: Vector2) -> void:
|
||||
|
||||
velocity.x = knockback_direction * damage_knockback.x
|
||||
velocity.y = -damage_knockback.y
|
||||
_hurt_animation_timer = 0.18
|
||||
punch_timer = 0.0
|
||||
ground_pound_active = false
|
||||
COMBAT_FX.spawn(get_parent(), global_position, &"hit", knockback_direction)
|
||||
feedback_camera.call("impact", 1.5, 0.18)
|
||||
|
||||
health_changed.emit(current_health, character_data.max_health)
|
||||
|
||||
@@ -691,6 +767,8 @@ func take_damage(amount: int, source_position: Vector2) -> void:
|
||||
|
||||
func _die() -> void:
|
||||
is_dead = true
|
||||
_special_active = false
|
||||
feedback_camera.call("start_solo", 0.0)
|
||||
died.emit()
|
||||
|
||||
# Reloading from a deferred call avoids changing the scene tree while a
|
||||
@@ -707,6 +785,8 @@ func _reload_level() -> void:
|
||||
# ============================================================================
|
||||
|
||||
func _update_timers(delta: float) -> void:
|
||||
_hurt_animation_timer = maxf(0.0, _hurt_animation_timer - delta)
|
||||
_landing_animation_timer = maxf(0.0, _landing_animation_timer - delta)
|
||||
punch_timer = max(punch_timer - delta, 0.0)
|
||||
attack_cooldown_timer = max(attack_cooldown_timer - delta, 0.0)
|
||||
ground_pound_debug_timer = max(ground_pound_debug_timer - delta, 0.0)
|
||||
@@ -731,13 +811,44 @@ func _update_timers(delta: float) -> void:
|
||||
|
||||
|
||||
func _update_animation() -> void:
|
||||
# There are only idle and walk animations at the moment. Until proper jump
|
||||
# and attack animations arrive, walk is used only for horizontal walking and
|
||||
# idle is the safe fallback for every other state.
|
||||
if is_on_floor() and abs(velocity.x) > 10.0:
|
||||
animated_sprite.play("walk")
|
||||
var animation_name: StringName = &"idle"
|
||||
if _special_active:
|
||||
if _special_elapsed < special_duration * 0.15:
|
||||
animation_name = &"special_start"
|
||||
elif _special_elapsed > special_duration * 0.85:
|
||||
animation_name = &"special_end"
|
||||
else:
|
||||
animation_name = &"special"
|
||||
elif _hurt_animation_timer > 0.0:
|
||||
animation_name = &"hurt"
|
||||
elif ground_pound_active:
|
||||
animation_name = &"ground_pound"
|
||||
elif punch_timer > 0.0:
|
||||
animation_name = &"punch"
|
||||
elif not is_on_floor():
|
||||
animation_name = &"jump" if velocity.y < 0.0 else &"fall"
|
||||
elif _landing_animation_timer > 0.0:
|
||||
animation_name = &"land"
|
||||
elif absf(velocity.x) > 10.0:
|
||||
animation_name = &"walk"
|
||||
|
||||
# Custom CharacterData can still provide a smaller animation set.
|
||||
if not animated_sprite.sprite_frames.has_animation(animation_name):
|
||||
animation_name = &"idle"
|
||||
if animated_sprite.animation != animation_name or not animated_sprite.is_playing():
|
||||
# Finished one-shot animations hold their last frame until the state changes.
|
||||
if animated_sprite.animation == animation_name and animated_sprite.frame > 0:
|
||||
return
|
||||
animated_sprite.play(animation_name)
|
||||
|
||||
|
||||
func _update_visual_feedback() -> void:
|
||||
if _hurt_animation_timer > 0.10:
|
||||
animated_sprite.self_modulate = Color(1.8, 1.8, 1.8)
|
||||
elif invulnerability_timer > 0.0 and int(invulnerability_timer * 12.0) % 2 == 0:
|
||||
animated_sprite.self_modulate = Color(1.0, 1.0, 1.0, 0.55)
|
||||
else:
|
||||
animated_sprite.play("idle")
|
||||
animated_sprite.self_modulate = Color.WHITE
|
||||
|
||||
|
||||
# ============================================================================
|
||||
@@ -766,6 +877,18 @@ func _setup_attack_hitboxes() -> void:
|
||||
# ============================================================================
|
||||
|
||||
func _draw() -> void:
|
||||
if is_on_floor():
|
||||
draw_rect(Rect2(-14, 24, 28, 3), Color(0.05, 0.06, 0.10, 0.25))
|
||||
if ground_pound_active:
|
||||
for side: float in [-1.0, 1.0]:
|
||||
draw_line(Vector2(17 * side, -30), Vector2(17 * side, -9), Color(1.0, 0.8, 0.45, 0.75), 2.0)
|
||||
# Pickup messages remain visible when collision debugging is disabled.
|
||||
var font: Font = ThemeDB.get_default_theme().get_font("font", "Label")
|
||||
if font != null:
|
||||
for entry: Dictionary in _floating_texts:
|
||||
var text_color: Color = entry.color
|
||||
text_color.a = clampf(float(entry.timer) / 1.2, 0.0, 1.0)
|
||||
draw_string(font, entry.pos, entry.text, HORIZONTAL_ALIGNMENT_LEFT, -1, 14, text_color)
|
||||
if not show_debug_hitboxes:
|
||||
return
|
||||
|
||||
@@ -828,13 +951,6 @@ func _draw() -> void:
|
||||
2.0
|
||||
)
|
||||
|
||||
var font: Font = ThemeDB.get_default_theme().get_font("font", "Label")
|
||||
if font != null:
|
||||
for entry in _floating_texts:
|
||||
var alpha: float = clamp(entry.timer / 1.2, 0.0, 1.0)
|
||||
var col = entry.color
|
||||
col.a = alpha
|
||||
draw_string(font, entry.pos, entry.text, 0, -1, 14, col)
|
||||
|
||||
|
||||
func _draw_rectangle_collision(
|
||||
|
||||
+4
-3
@@ -8,7 +8,7 @@
|
||||
[ext_resource type="PackedScene" path="res://ui/hud/special_charge_hud.tscn" id="6_special_charge_hud"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="PlayerShape"]
|
||||
size = Vector2(41, 74)
|
||||
size = Vector2(26, 52)
|
||||
|
||||
[node name="Player" type="CharacterBody2D" unique_id=730885194 groups=["player"]]
|
||||
z_index = 1
|
||||
@@ -43,10 +43,11 @@ monitorable = false
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=1502470275]
|
||||
z_index = -1
|
||||
scale = Vector2(0.56, 0.56)
|
||||
texture_filter = 1
|
||||
position = Vector2(0, -2)
|
||||
sprite_frames = ExtResource("2_frames")
|
||||
animation = &"idle"
|
||||
speed_scale = 2.0
|
||||
speed_scale = 1.0
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="." unique_id=902833396]
|
||||
zoom = Vector2(2, 2)
|
||||
|
||||
Reference in new issue
Block a user