Compare commits

...

2 Commits

Author SHA1 Message Date
Luna Brovchuk ea0172c66d Merge branch 'main' of http://meowo.cc:3000/meowo/LD54 2023-10-01 20:37:27 +02:00
Luna Brovchuk cd95bd01c4 TODO: Death 2023-10-01 20:37:22 +02:00
7 changed files with 25 additions and 7 deletions

View File

@ -0,0 +1,3 @@
[gd_resource type="ShaderMaterial" format=2]
[resource]

View File

@ -8,7 +8,7 @@ var frozen = false
var target
func _physics_process(delta):
if target != null and is_instance_valid(target):
if target != null and is_instance_valid(target) and not target.dead:
var target_texture = target.get_node("Sprite").frames.get_frame("idle", 0)
var target_sprite_size = Vector2(target_texture.get_width(), target_texture.get_width())
var target_center = target.global_position + (target_sprite_size / 2)

View File

@ -19,7 +19,6 @@ script = ExtResource( 2 )
use_parent_material = true
frames = ExtResource( 1 )
animation = "idle"
frame = 3
playing = true
centered = false

View File

@ -25,7 +25,7 @@ flip_h = true
use_parent_material = true
frames = ExtResource( 1 )
animation = "idle"
frame = 1
frame = 4
playing = true
centered = false

View File

@ -13,7 +13,7 @@ script = ExtResource( 2 )
use_parent_material = true
frames = ExtResource( 1 )
animation = "idle"
frame = 1
frame = 2
playing = true
centered = false

View File

@ -4,13 +4,13 @@ var velocity = Vector2.ZERO
var sin_timer = .0
var speed = 64
var poisoned = false
var damage = 5
var damage = 8
var frozen = false
var target
func _physics_process(delta):
sin_timer += delta
if target != null and is_instance_valid(target):
if target != null and is_instance_valid(target) and not target.dead:
var target_texture = target.get_node("Sprite").frames.get_frame("idle", 0)
var target_sprite_size = Vector2(target_texture.get_width(), target_texture.get_width())
var target_center = target.global_position + (target_sprite_size / 2)

View File

@ -1,6 +1,9 @@
extends KinematicBody2D
var empty_material = load("res://res/shaders/empty_material.tscn")
var hp
var dead = false
var dead_timer = .0
var poisoned = false
var poisoned_timer = .0
var speed_multiplier = 1
@ -15,9 +18,22 @@ var frozen = false
func deal_damage(amount):
hp -= amount
if hp <= 0:
call_deferred("free")
death()
func death():
dead = true
$Area2D.call_deferred("free")
remove_from_group("enemy")
material = empty_material
$Sprite.material = empty_material
func _physics_process(delta):
if dead:
dead_timer += delta
$Sprite.modulate.a = 1 - (dead_timer / 2)
if dead_timer >= 2.0:
self.call_deferred("free")
if poisoned:
poisoned_timer += delta
poison_damage_timer += delta