Compare commits

..

No commits in common. "9ce8c6668018a658ac075aaa40ab5dc567420af8" and "d11bfe5d223d0bd059e35a30e3996ecbfd311f83" have entirely different histories.

3 changed files with 25 additions and 22 deletions

View File

@ -33,7 +33,7 @@ func _physics_process(delta):
target_center = target.global_position + Vector2(0, 2)
self.global_position = self.global_position.move_toward(target_center, delta * speed * speed_modifier)
else:
call_deferred("free")
self.call_deferred("free")
func area_entered(area):
var parent = area.get_parent()

View File

@ -3,7 +3,9 @@ extends KinematicBody2D
var velocity = Vector2.ZERO
var sin_timer = .0
var speed = 64
var poisoned = false
var damage = 8
var frozen = false
var target
func _physics_process(delta):
@ -23,4 +25,6 @@ func area_entered(area):
var parent = area.get_parent()
if parent.is_in_group("enemy"):
parent.deal_damage(damage)
parent.frozen = frozen
parent.poisoned = poisoned
call_deferred("free")

View File

@ -5,16 +5,17 @@ var empty_material = load("res://res/shaders/empty_material.tres")
var hp
var dead = false
var dead_timer = .0
var poison_damage = 0
var poisoned = false
var poisoned_timer = .0
var speed_multiplier = 1
var frozen_timer = .0
var frozen_time = 2
var freeze_modifier = 1
var poisoned_time = 3
var poisoned_damage_timer = .0
var poisoned_damage = 5
var poison_damage_timer = .0
var death_position
var frozen = false
func deal_damage(amount):
hp -= amount
@ -28,41 +29,39 @@ func _process(delta):
$Sprite.flip_h = true if player.global_position.x > self.global_position.x else false
func death():
if not dead:
dead = true
$Sprite.playing = false
$Area2D.call_deferred("free")
remove_from_group("enemy")
material = empty_material
$Sprite.material = empty_material
dead = true
$Sprite.playing = false
$Area2D.call_deferred("free")
remove_from_group("enemy")
material = empty_material
$Sprite.material = empty_material
func _physics_process(delta):
if Global.playing:
death_position = self.global_position
if dead:
self.global_position = death_position
dead_timer += delta
$Sprite.modulate.a = 1 - (dead_timer * 2)
else:
death_position = self.global_position
if dead_timer >= 0.5:
self.call_deferred("free")
if poison_damage != 0:
if poisoned:
poisoned_timer += delta
poisoned_damage_timer += delta
poison_damage_timer += delta
if poisoned_timer >= poisoned_time:
poisoned_timer = .0
poisoned_damage_timer = .0
poison_damage = 0
if poisoned_damage_timer >= 1:
deal_damage(poison_damage)
poison_damage_timer = .0
poisoned = false
if poison_damage_timer >= 1:
deal_damage(poisoned_damage)
if freeze_modifier != 1:
if frozen:
frozen_timer += delta
speed_multiplier = freeze_modifier
speed_multiplier = 0.5
if frozen_timer >= frozen_time:
frozen_time = 0
freeze_modifier = 1
frozen = false
else:
speed_multiplier = 1