Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if love.keyboard.isDown("z") then
- hero.punch=1 -- the player is trying to punch
- time.punch=time.punch+dt -- count downtime of z
- -- block player from cheating by holding down z
- if time.punch>hero.punchduration then
- hero.punch=0 -- turn off punching ( in love.draw() )
- else end
- if time.punch>0.6 then -- if player keeps punch held
- time.punch=0 -- reset timer after 0.6s
- else end
- else
- hero.punch=0 -- the player is not trying to punch
- time.punch=0 -- reset when he releases the key
- end
Advertisement
Add Comment
Please, Sign In to add comment