mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 23:10:08 +01:00
Fix player trail appearance in Dodge The Creeps (#986)
This commit is contained in:
@@ -33,11 +33,12 @@ func _process(delta):
|
||||
if velocity.x != 0:
|
||||
$AnimatedSprite2D.animation = &"right"
|
||||
$AnimatedSprite2D.flip_v = false
|
||||
$Trail.rotation = 0
|
||||
$AnimatedSprite2D.flip_h = velocity.x < 0
|
||||
elif velocity.y != 0:
|
||||
$AnimatedSprite2D.animation = &"up"
|
||||
$AnimatedSprite2D.flip_v = velocity.y > 0
|
||||
|
||||
$Trail.rotation = PI if velocity.y > 0 else 0
|
||||
|
||||
func start(pos):
|
||||
position = pos
|
||||
|
||||
@@ -8,12 +8,24 @@
|
||||
|
||||
[sub_resource type="SpriteFrames" id="1"]
|
||||
animations = [{
|
||||
"frames": [ExtResource( "2" ), ExtResource( "3" )],
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("2")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("3")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"right",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ExtResource( "4" ), ExtResource( "5" )],
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("4")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("5")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"up",
|
||||
"speed": 5.0
|
||||
@@ -27,37 +39,37 @@ height = 68.0
|
||||
colors = PackedColorArray(1, 1, 1, 0.501961, 1, 1, 1, 0)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="4"]
|
||||
gradient = SubResource( "3" )
|
||||
gradient = SubResource("3")
|
||||
|
||||
[sub_resource type="Curve" id="5"]
|
||||
_data = [Vector2(0.00501098, 0.5), 0.0, 0.0, 0, 0, Vector2(0.994989, 0.324), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="6"]
|
||||
curve = SubResource( "5" )
|
||||
curve = SubResource("5")
|
||||
|
||||
[sub_resource type="ParticlesMaterial" id="7"]
|
||||
[sub_resource type="ParticleProcessMaterial" id="7"]
|
||||
gravity = Vector3(0, 0, 0)
|
||||
scale_curve = SubResource( "6" )
|
||||
color_ramp = SubResource( "4" )
|
||||
scale_curve = SubResource("6")
|
||||
color_ramp = SubResource("4")
|
||||
|
||||
[node name="Player" type="Area2D"]
|
||||
z_index = 10
|
||||
script = ExtResource( "1" )
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
scale = Vector2(0.5, 0.5)
|
||||
frames = SubResource( "1" )
|
||||
sprite_frames = SubResource("1")
|
||||
animation = &"right"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( "2" )
|
||||
shape = SubResource("2")
|
||||
|
||||
[node name="Trail" type="GPUParticles2D" parent="."]
|
||||
z_index = -1
|
||||
amount = 10
|
||||
process_material = SubResource("7")
|
||||
texture = ExtResource("2")
|
||||
speed_scale = 2.0
|
||||
local_coords = false
|
||||
process_material = SubResource( "7" )
|
||||
texture = ExtResource( "2" )
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_Player_body_entered"]
|
||||
|
||||
@@ -17,10 +17,10 @@ and avoid the enemies for as long as possible.
|
||||
This is a finished version of the game featured in the 'Your first 2D game'
|
||||
tutorial in the documentation. For more details, consider
|
||||
following the tutorial in the documentation."
|
||||
run/main_scene="res://Main.tscn"
|
||||
config/features=PackedStringArray("4.0")
|
||||
config/icon="res://icon.webp"
|
||||
config/tags=PackedStringArray("2d", "demo", "official")
|
||||
run/main_scene="res://Main.tscn"
|
||||
config/features=PackedStringArray("4.1")
|
||||
config/icon="res://icon.webp"
|
||||
|
||||
[debug]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user