## Search found 84 matches

Tue Aug 25, 2020 2:26 pm
Forum: General
Topic: Measure length of keystroke and print on screen
Replies: 10
Views: 5009

### Re: Measure length of keystroke and print on screen

ivan wrote:
Mon Aug 24, 2020 6:10 am
...
function love.keypressed(k,s)
keys[s] = love.timer.getTime()
end
function love.keypressed(k,s)
keys[s] = nil
end
...
Just spotted a typo for anyone interested: the second keypressed(k, s) should read keyreleased(k, s)
Fri Aug 17, 2018 7:06 pm
Forum: Support and Development
Topic: Shrinking numbers
Replies: 2
Views: 895

### Re: Shrinking numbers

Thank you for the detailed reply, it makes perfect sense, I shall try to incorporate it in my code
Fri Aug 17, 2018 3:43 pm
Forum: Support and Development
Topic: Shrinking numbers
Replies: 2
Views: 895

### Shrinking numbers

Why do the values gradually 'shrink' with this piece of code which rotates points in 3d around the y axis: cos1 = math.cos(math.rad(1)) sin1 = math.sin(math.rad(1)) for i = 1, numPoints do points[i].x = points[i].x * cos1 + points[i].z * sin1 points[i].z = points[i].z * cos1 - points[i].x * sin1 end...
Tue Aug 14, 2018 10:03 am
Forum: Support and Development
Topic: Camera Zoom to Mouse
Replies: 4
Views: 1250

### Re: Camera Zoom to Mouse

Actually, I've just realised that doesn't do quite what you want! You don't want any movement of the camera until the mousewheel is scrolled - shouldn't be too hard to fix that though
Tue Aug 14, 2018 9:59 am
Forum: Support and Development
Topic: Camera Zoom to Mouse
Replies: 4
Views: 1250

### Re: Camera Zoom to Mouse

Well I've never used a camera library but this code does what you want (I think - test it by adding some more images) and is pretty self-explanatory. If you're committed to using a library I'm afraid I won't be able to help further. supcom.jpeg function love.load(arg) love.graphics.setBackgroundColo...
Mon Aug 13, 2018 8:34 pm
Forum: Support and Development
Topic: Camera Zoom to Mouse
Replies: 4
Views: 1250

### Re: Camera Zoom to Mouse

Can you clarify this a bit? When you zoom in, do you want the view to be automatically repositioned (or at least moved towards) to the centre of the screen as well? If not, some points around the zoom centre might disappear from view altogether. For example, if your window is 800x600 and the mouse i...
Thu May 17, 2018 10:44 am
Forum: Support and Development
Topic: Why this error on love.event.quit() ?
Replies: 8
Views: 2547

### Re: Why this error on love.event.quit() ?

I don't see how line 149 is being executed after the call to love.event.quit(). love.event.quit() places a 'quit' event in the event queue. It does not terminate the program immediately. Use os.exit() for that. OK thanks. I thought it might be something to do with that but I thought it would most l...
Thu May 17, 2018 10:02 am
Forum: Support and Development
Topic: Why this error on love.event.quit() ?
Replies: 8
Views: 2547

### Re: Why this error on love.event.quit() ?

Right, I've found what causes the error but not why it only happens when exiting with the keyboard. function love.keypressed(key) if key == 'escape' then love.event.quit() end -- HERE'S THE PROBLEM: local tX, tY = 0, 0 if key == "left" then tX = player.x - 1 tY = player.y end if key == "right" then ...
Thu May 17, 2018 9:49 am
Forum: Support and Development
Topic: Why this error on love.event.quit() ?
Replies: 8
Views: 2547

### Re: Why this error on love.event.quit() ?

Can you post the whole code? I'd prefer not to at the moment as it contains the tiniest grain of an idea I'd like to keep to myself atm :D I moved if key == 'escape' then love.event.quit() end to the end of love.keypressed() but the result is exactly the same. I don't see how line 149 is being exec...
Thu May 17, 2018 8:24 am
Forum: Support and Development
Topic: Why this error on love.event.quit() ?
Replies: 8
Views: 2547

### Why this error on love.event.quit() ?

In function love.keypressed() the first line is: if key == 'escape' then love.event.quit() end If I close the game window using the escape key I get this: Error: main.lua:149: attempt to index a nil value stack traceback: [string "boot.lua"]:637: in function '__index' main.lua:149: in function <main...