From 185a87a828a374fb4c8bf0c3509e1f3764cc4d29 Mon Sep 17 00:00:00 2001 From: Just Dzhi Date: Sun, 1 Oct 2023 22:43:23 +0400 Subject: [PATCH] small changes in particles --- src/models/player/Player.tscn | 13 ++++++++----- src/models/player/player.gd | 2 ++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/models/player/Player.tscn b/src/models/player/Player.tscn index 07a9d28..77b9f7f 100644 --- a/src/models/player/Player.tscn +++ b/src/models/player/Player.tscn @@ -5,10 +5,10 @@ [ext_resource path="res://res/shaders/colorize.tres" type="Material" id=3] [sub_resource type="RectangleShape2D" id=1] -extents = Vector2( 4, 4 ) +extents = Vector2( 3.5, 3.5 ) [sub_resource type="RectangleShape2D" id=2] -extents = Vector2( 7, 11 ) +extents = Vector2( 3.5, 9 ) [sub_resource type="Animation" id=4] resource_name = "RESET" @@ -48,7 +48,7 @@ tracks/0/loop_wrap = true tracks/0/imported = false tracks/0/enabled = true tracks/0/keys = { -"times": PoolRealArray( 0, 0.9 ), +"times": PoolRealArray( 0, 2 ), "transitions": PoolRealArray( 1, 1 ), "update": 1, "values": [ true, false ] @@ -100,12 +100,15 @@ anims/damage = SubResource( 3 ) [node name="CPUParticles2D" type="CPUParticles2D" parent="."] position = Vector2( 10, 23 ) emitting = false -amount = 12 +lifetime = 0.5 lifetime_randomness = 1.0 local_coords = false +emission_shape = 1 +emission_sphere_radius = 2.0 direction = Vector2( -1, 0 ) +spread = 15.0 gravity = Vector2( 0, -10 ) initial_velocity = 8.0 -color = Color( 0.458824, 0.458824, 0.458824, 1 ) +color = Color( 0.458824, 0.458824, 0.458824, 0.588235 ) [connection signal="area_entered" from="EnemyCollision" to="." method="area_entered"] diff --git a/src/models/player/player.gd b/src/models/player/player.gd index e6b0880..2fc668c 100644 --- a/src/models/player/player.gd +++ b/src/models/player/player.gd @@ -94,6 +94,8 @@ func _process(_delta): $Sprite.play("idle") if velocity == Vector2.ZERO else $Sprite.play("run") if abs(velocity.x) > 10: $Sprite.flip_h = true if velocity.x < 0 else false + + if velocity != Vector2.ZERO: $CPUParticles2D.emitting = true $CPUParticles2D.direction.x = 1 if velocity.x < 0 else -1 else: