summaryrefslogtreecommitdiff
path: root/dyl.lua
diff options
context:
space:
mode:
authorElizabeth Alexander Hunt <me@liz.coffee>2026-05-09 16:24:51 -0700
committerElizabeth Alexander Hunt <me@liz.coffee>2026-05-09 16:24:51 -0700
commit78fd742b1e276aec3eb1e939542ef51c3231b060 (patch)
tree6e43c0a0b05134285ab093299e772d9d533a5e87 /dyl.lua
parentb4cfed422d753bea585572c693b6d1bd8ef68f6e (diff)
downloaddyl8-78fd742b1e276aec3eb1e939542ef51c3231b060.tar.gz
dyl8-78fd742b1e276aec3eb1e939542ef51c3231b060.zip
Applies damage impulse for only frame
Diffstat (limited to 'dyl.lua')
-rw-r--r--dyl.lua12
1 files changed, 7 insertions, 5 deletions
diff --git a/dyl.lua b/dyl.lua
index 70325c3..8c5f8a2 100644
--- a/dyl.lua
+++ b/dyl.lua
@@ -56,7 +56,7 @@ function enemy()
}
}
)
- :b_state(States.Walk)
+ :b_state(States.Idle)
return EnemyBuilder:build()
end
@@ -126,16 +126,18 @@ end
function sword()
_particle_distance = 4
_attack_burst_sec = 0.200
- _sword_damage = { amount = 2, knockback = { magnitude = 200, time = 0.080 } }
+ _sword_damage = { amount = 2, knockback = { magnitude = 300, time = 0.080 } }
SwordBuilder = EntityBuilder:new(World)
function SwordBuilder: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)
self:equip(slashing_particle(self), _particle_distance)
self.damage = _sword_damage
- elseif self.state == States.Slashing and self.state_stopwatch > _slashing_timer_sec then
+ elseif self.state == States.Slashing then
self.damage = nil
- self:transition_to(States.Equipped)
+ if (self.state_stopwatch > _slashing_timer_sec) then
+ self:transition_to(States.Equipped)
+ end
end
end
SwordBuilder:b_type(Entities.Sword)
@@ -230,7 +232,7 @@ function _init()
end
_step_t = time()
-function _update()
+function _update60()
-- clear here in case we want to print to screen outside of _draw
cls(0)