Compare commits
No commits in common. "9ce8c6668018a658ac075aaa40ab5dc567420af8" and "d11bfe5d223d0bd059e35a30e3996ecbfd311f83" have entirely different histories.
9ce8c66680
...
d11bfe5d22
|
@ -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()
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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,7 +29,6 @@ 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")
|
||||
|
@ -38,31 +38,30 @@ func death():
|
|||
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue