summaryrefslogtreecommitdiff
path: root/dyl.lua
diff options
context:
space:
mode:
Diffstat (limited to 'dyl.lua')
-rw-r--r--dyl.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/dyl.lua b/dyl.lua
index e379ae3..bd024ef 100644
--- a/dyl.lua
+++ b/dyl.lua
@@ -31,6 +31,7 @@ enemy = entity()
function enemy:transition_state()
end
enemy:b_type(Entities.Enemy)
+ :b_health(100)
:b_position(vec2(30, 40))
:b_sprite_position(vec2(30, 30))
:b_line_of_sight(vec2(1, 0))
@@ -100,16 +101,18 @@ bow:b_type(Entities.Bow)
sword = entity()
_attack_burst_sec = 0.200
+_sword_damage = { amount = 2, knockback = { magnitude = 200, time = 0.080 } }
function sword:transition_state()
if button_just_pressed(5) and self.state == States.Equipped and self.state_stopwatch > _attack_burst_sec then
self:transition_to(States.Slashing)
spawn_slashing_particle(self)
+ self.damage = _sword_damage
elseif self.state == States.Slashing and self.state_stopwatch > _slashing_timer_sec then
+ self.damage = nil
self:transition_to(States.Equipped)
end
end
-sword
- :b_type(Entities.Sword)
+sword:b_type(Entities.Sword)
:b_line_of_sight(vec2(1, 0))
:b_position(vec2(0, 0))
:b_sprite_position(vec2(0, 0))