Compare commits
2 Commits
ddffee61af
...
ea0172c66d
Author | SHA1 | Date |
---|---|---|
Luna Brovchuk | ea0172c66d | |
Luna Brovchuk | cd95bd01c4 |
|
@ -0,0 +1,3 @@
|
||||||
|
[gd_resource type="ShaderMaterial" format=2]
|
||||||
|
|
||||||
|
[resource]
|
|
@ -8,7 +8,7 @@ var frozen = false
|
||||||
var target
|
var target
|
||||||
|
|
||||||
func _physics_process(delta):
|
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_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_sprite_size = Vector2(target_texture.get_width(), target_texture.get_width())
|
||||||
var target_center = target.global_position + (target_sprite_size / 2)
|
var target_center = target.global_position + (target_sprite_size / 2)
|
||||||
|
|
|
@ -19,7 +19,6 @@ script = ExtResource( 2 )
|
||||||
use_parent_material = true
|
use_parent_material = true
|
||||||
frames = ExtResource( 1 )
|
frames = ExtResource( 1 )
|
||||||
animation = "idle"
|
animation = "idle"
|
||||||
frame = 3
|
|
||||||
playing = true
|
playing = true
|
||||||
centered = false
|
centered = false
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ flip_h = true
|
||||||
use_parent_material = true
|
use_parent_material = true
|
||||||
frames = ExtResource( 1 )
|
frames = ExtResource( 1 )
|
||||||
animation = "idle"
|
animation = "idle"
|
||||||
frame = 1
|
frame = 4
|
||||||
playing = true
|
playing = true
|
||||||
centered = false
|
centered = false
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ script = ExtResource( 2 )
|
||||||
use_parent_material = true
|
use_parent_material = true
|
||||||
frames = ExtResource( 1 )
|
frames = ExtResource( 1 )
|
||||||
animation = "idle"
|
animation = "idle"
|
||||||
frame = 1
|
frame = 2
|
||||||
playing = true
|
playing = true
|
||||||
centered = false
|
centered = false
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,13 @@ var velocity = Vector2.ZERO
|
||||||
var sin_timer = .0
|
var sin_timer = .0
|
||||||
var speed = 64
|
var speed = 64
|
||||||
var poisoned = false
|
var poisoned = false
|
||||||
var damage = 5
|
var damage = 8
|
||||||
var frozen = false
|
var frozen = false
|
||||||
var target
|
var target
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
sin_timer += 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_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_sprite_size = Vector2(target_texture.get_width(), target_texture.get_width())
|
||||||
var target_center = target.global_position + (target_sprite_size / 2)
|
var target_center = target.global_position + (target_sprite_size / 2)
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
extends KinematicBody2D
|
extends KinematicBody2D
|
||||||
|
|
||||||
|
var empty_material = load("res://res/shaders/empty_material.tscn")
|
||||||
var hp
|
var hp
|
||||||
|
var dead = false
|
||||||
|
var dead_timer = .0
|
||||||
var poisoned = false
|
var poisoned = false
|
||||||
var poisoned_timer = .0
|
var poisoned_timer = .0
|
||||||
var speed_multiplier = 1
|
var speed_multiplier = 1
|
||||||
|
@ -15,9 +18,22 @@ var frozen = false
|
||||||
func deal_damage(amount):
|
func deal_damage(amount):
|
||||||
hp -= amount
|
hp -= amount
|
||||||
if hp <= 0:
|
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):
|
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:
|
if poisoned:
|
||||||
poisoned_timer += delta
|
poisoned_timer += delta
|
||||||
poison_damage_timer += delta
|
poison_damage_timer += delta
|
||||||
|
|
Loading…
Reference in New Issue