Search found 7 matches
- Tue Aug 25, 2020 7:52 pm
- Forum: General
- Topic: Event Cool downs
- Replies: 2
- Views: 5405
Re: Event Cool downs
And here's my wasReleased function and keysReleased function function love.keyboard.wasReleased(key) if (love.keyboard.keysReleased[key]) then if love.keyboard.isDown(key) then return false else return true end else return false end end function love.keyreleased(key) love.keyboard.keysReleased[key] ...
- Tue Aug 25, 2020 7:47 pm
- Forum: General
- Topic: Event Cool downs
- Replies: 2
- Views: 5405
Event Cool downs
I've been trying to make a game in which a character shoots a projectile. A problem I have is that bullets can be spammed can be shot right after one another so I wanted to make it so between each shot there is a 2 second cool down. I've attempted at creating a cool down and have succeeded but not i...
- Mon Aug 24, 2020 6:32 pm
- Forum: General
- Topic: Measure length of keystroke and print on screen
- Replies: 10
- Views: 10658
Re: Measure length of keystroke and print on screen
My only problem now is the fact that where i need the code to be is in a class. How exactly would i implement your code into this: This is names Player1.lua and it is a class Player1 = Class{} local keys = { ['q'] = key } function Player1:init(x, y, width, height) self.x = x self.y = y self.width = ...
- Mon Aug 24, 2020 12:41 pm
- Forum: General
- Topic: Measure length of keystroke and print on screen
- Replies: 10
- Views: 10658
Re: Measure length of keystroke and print on screen
Oh ok, thank you! Also is there a way that it will only measure the time for certain keys?
- Mon Aug 24, 2020 11:32 am
- Forum: General
- Topic: Measure length of keystroke and print on screen
- Replies: 10
- Views: 10658
Re: Measure length of keystroke and print on screen
Thanks Zorg for the code and it works fine but when a key is released it shows this error
main.lua:18: attempt to concatenate local 'v' (a boolean value)
main.lua:18 is the print line in love.draw
main.lua:18: attempt to concatenate local 'v' (a boolean value)
main.lua:18 is the print line in love.draw
- Sun Aug 23, 2020 8:30 pm
- Forum: General
- Topic: Measure length of keystroke and print on screen
- Replies: 10
- Views: 10658
Re: Measure length of keystroke and print on screen
Do you think you might be able to give me an example program that measures the time and prints it?
- Sun Aug 23, 2020 5:33 pm
- Forum: General
- Topic: Measure length of keystroke and print on screen
- Replies: 10
- Views: 10658
Measure length of keystroke and print on screen
Is it possible to measure the length of time a key is pressed? For example, how long is the "m" key pressed? Once the key is released, then I would like to print that length of time on the screen. Here is an example what I'm trying to do. I'd like the user to press and hold a key. The leng...