Better dash animation (celeste style)

This commit is contained in:
Sagi Dayan 2020-09-17 11:37:03 -04:00
parent 7e2c93104b
commit 5884c3294e
8 changed files with 155 additions and 43 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/herochar_dash_partical.png-69b8bf33921f19c267db47aa0649ff68.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/Player/herochar_dash_partical.png"
dest_files=[ "res://.import/herochar_dash_partical.png-69b8bf33921f19c267db47aa0649ff68.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/herochar_dash_partical_left.png-35044098d95eb6a11a6988bd3f3a5228.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/Player/herochar_dash_partical_left.png"
dest_files=[ "res://.import/herochar_dash_partical_left.png-35044098d95eb6a11a6988bd3f3a5228.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -0,0 +1,37 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://assets/Player/herochar_dash_partical_left.png" type="Texture" id=1]
[sub_resource type="Gradient" id=1]
colors = PoolColorArray( 0, 1, 1, 0.694118, 0.862745, 0.866667, 0.901961, 0 )
[sub_resource type="GradientTexture" id=2]
gradient = SubResource( 1 )
[sub_resource type="Curve" id=3]
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.475 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=4]
curve = SubResource( 3 )
[sub_resource type="ParticlesMaterial" id=5]
flag_disable_z = true
direction = Vector3( 0, 0, 0 )
spread = 0.0
gravity = Vector3( 0, 0, 0 )
initial_velocity = 10.0
orbit_velocity = 0.0
orbit_velocity_random = 0.0
scale_curve = SubResource( 4 )
color_ramp = SubResource( 2 )
[node name="DashParticlesLeft" type="Particles2D"]
show_behind_parent = true
position = Vector2( -0.184715, -8.0756 )
emitting = false
amount = 15
lifetime = 0.8
speed_scale = 3.0
local_coords = false
process_material = SubResource( 5 )
texture = ExtResource( 1 )

View file

@ -0,0 +1,37 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://assets/Player/herochar_dash_partical.png" type="Texture" id=1]
[sub_resource type="Gradient" id=1]
colors = PoolColorArray( 0, 1, 1, 0.694118, 0.862745, 0.866667, 0.901961, 0 )
[sub_resource type="GradientTexture" id=2]
gradient = SubResource( 1 )
[sub_resource type="Curve" id=3]
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.475 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=4]
curve = SubResource( 3 )
[sub_resource type="ParticlesMaterial" id=5]
flag_disable_z = true
direction = Vector3( 0, 0, 0 )
spread = 0.0
gravity = Vector3( 0, 0, 0 )
initial_velocity = 10.0
orbit_velocity = 0.0
orbit_velocity_random = 0.0
scale_curve = SubResource( 4 )
color_ramp = SubResource( 2 )
[node name="DashParticlesRight" type="Particles2D"]
show_behind_parent = true
position = Vector2( -0.184715, -8.0756 )
emitting = false
amount = 15
lifetime = 0.8
speed_scale = 3.0
local_coords = false
process_material = SubResource( 5 )
texture = ExtResource( 1 )

View file

@ -94,12 +94,10 @@ func calculate_move_velocity(direction:Vector2, is_jump_canceled:bool, delta:fl
output = dash_velocity
_can_dash = false
_is_dashing = true # turn off gravity while dashing
$DashParticles.emitting = true
$DashParticles.position = Vector2(
position.x,
position.y - 8
)
$DashParticles.set_as_toplevel(true)
if dash_velocity.x < 0 :
$DashParticlesLeft.emitting = true;
else:
$DashParticlesRight.emitting = true
$DashTimeout.start()
return output;
@ -143,7 +141,8 @@ func die():
$AnimationPlayer.play("die")
func _on_DashTimeout_timeout() -> void:
$DashParticles.emitting = false
$DashParticlesLeft.emitting = false
$DashParticlesRight.emitting = false
_velocity.x = run_speed * _velocity.normalized().x;
_is_dashing = false
pass # Replace with function body.

View file

@ -1,6 +1,8 @@
[gd_scene load_steps=18 format=2]
[gd_scene load_steps=15 format=2]
[ext_resource path="res://src/Actors/DashParticles_right.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Actors/Player.gd" type="Script" id=2]
[ext_resource path="res://src/Actors/DashParticles_left.tscn" type="PackedScene" id=3]
[ext_resource path="res://assets/Items/torch_ligt_texture.png" type="Texture" id=7]
[ext_resource path="res://assets/Player/herochar_spritesheet.png" type="Texture" id=8]
@ -264,32 +266,6 @@ tracks/1/keys = {
"values": [ Color( 0, 0, 0, 0 ) ]
}
[sub_resource type="Gradient" id=10]
offsets = PoolRealArray( 0, 0.668103, 1 )
colors = PoolColorArray( 0.6, 0.713726, 1, 1, 0, 0.12549, 0.380392, 0.760784, 1, 1, 1, 0 )
[sub_resource type="GradientTexture" id=11]
gradient = SubResource( 10 )
[sub_resource type="Curve" id=12]
max_value = 2.0
_data = [ Vector2( 0, 2 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.0835871 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=13]
curve = SubResource( 12 )
[sub_resource type="ParticlesMaterial" id=14]
trail_size_modifier = SubResource( 13 )
trail_color_modifier = SubResource( 11 )
emission_shape = 2
emission_box_extents = Vector3( 20, 4, 1 )
flag_disable_z = true
gravity = Vector3( 0, 200, 0 )
initial_velocity_random = 0.11
orbit_velocity = 0.0
orbit_velocity_random = 0.0
linear_accel = 1.48
[node name="Player" type="KinematicBody2D"]
collision_mask = 30
script = ExtResource( 2 )
@ -316,7 +292,7 @@ position = Vector2( 0, -8 )
texture = ExtResource( 8 )
vframes = 13
hframes = 8
frame = 45
frame = 48
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "idle"
@ -344,12 +320,7 @@ __meta__ = {
wait_time = 0.1
one_shot = true
[node name="DashParticles" type="Particles2D" parent="."]
position = Vector2( 0, -7 )
emitting = false
amount = 30
lifetime = 0.2
one_shot = true
explosiveness = 0.5
process_material = SubResource( 14 )
[node name="DashParticlesLeft" parent="." instance=ExtResource( 3 )]
[node name="DashParticlesRight" parent="." instance=ExtResource( 1 )]
[connection signal="timeout" from="DashTimeout" to="." method="_on_DashTimeout_timeout"]