Luna Brovchuk 2023-10-01 20:37:27 +02:00
commit ea0172c66d
4 changed files with 24 additions and 6 deletions

View File

@ -15,5 +15,5 @@ void fragment(){
[resource]
shader = SubResource( 3 )
shader_param/active = true
shader_param/color = Color( 1, 1, 1, 0 )
shader_param/active = false
shader_param/color = Color( 1, 1, 1, 1 )

View File

@ -8,6 +8,9 @@ onready var player = $"../../Player"
func _ready():
hp = 15
func _process(delta):
$Sprite.flip_h = true if player.global_position.x > self.global_position.x else false
func _physics_process(_delta):
var player_position = player.global_position + Vector2(12, 12)
var angle = get_angle_to(player_position)

View File

@ -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 ]
@ -97,4 +97,15 @@ autoplay = "RESET"
anims/RESET = SubResource( 4 )
anims/damage = SubResource( 3 )
[node name="CPUParticles2D" type="CPUParticles2D" parent="."]
position = Vector2( 10, 23 )
emitting = false
amount = 12
lifetime_randomness = 1.0
local_coords = false
direction = Vector2( -1, 0 )
gravity = Vector2( 0, -10 )
initial_velocity = 8.0
color = Color( 0.458824, 0.458824, 0.458824, 1 )
[connection signal="area_entered" from="EnemyCollision" to="." method="area_entered"]

View File

@ -94,6 +94,10 @@ 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
$CPUParticles2D.emitting = true
$CPUParticles2D.direction.x = 1 if velocity.x < 0 else -1
else:
$CPUParticles2D.emitting = false
update()