Search found 3550 matches

by pgimeno
Mon Sep 25, 2023 3:55 pm
Forum: Support and Development
Topic: Linking Entities
Replies: 11
Views: 11168

Re: Linking Entities

What I do in these cases is build two tables, one for data and one for lookups. As you add ids to one table, you add them as key to another table with the number as data. Then you can use that second table to look up the index of a specific id.
by pgimeno
Fri Sep 22, 2023 10:50 am
Forum: Support and Development
Topic: Efficient Mouse Interaction and Event Handling for Objects
Replies: 14
Views: 7504

Re: Efficient Mouse Interaction and Event Handling for Objects

No this is still quite buggy, unless i am mistaken. Moreover i think that it is slower, than one might expect. One improvement would be to lock the active rectangle and release the lock only when mouse is released, but i dont know. Slower in the sense, the speed when we drag a rectangle is dubious....
by pgimeno
Tue Sep 19, 2023 1:56 pm
Forum: General
Topic: Offline-capable LÖVE tutorial
Replies: 20
Views: 19275

Re: Offline LÖVE documentation for download

There is an unwritten rule in the free software world: if you want something done, do it yourself rather than telling others to do it.
by pgimeno
Sat Sep 16, 2023 12:08 pm
Forum: Support and Development
Topic: Is it possible to create CubeImage arrays?
Replies: 2
Views: 967

Re: Is it possible to create CubeImage arrays?

TextureType only lets you specify one of array or cube or the others, so no, you can't have a Cube Array as you can't specify both at the same time.

Also, Texture:getLayerCount returns 1 for anything that isn't an array, so the result you're getting is expected.
by pgimeno
Thu Sep 14, 2023 1:42 pm
Forum: Support and Development
Topic: Validate UTF8 strings?
Replies: 2
Views: 960

Re: Validate UTF8 strings?

I don't think there's one, and unfortunately Lua doesn't have regular expressions, which would have been a solution. The best I've found is this: local function validate(s) for p, c in utf8.codes(s) do if c >= 0xD800 and c <= 0xDFFF or c == 0xFFFE or c == 0xFFFF then error("invalid UTF-8 codepo...
by pgimeno
Sat Sep 02, 2023 6:33 am
Forum: Support and Development
Topic: I have been having problem's scaling the camera for my game
Replies: 4
Views: 1536

Re: I have been having problem's scaling the camera for my game

MaxGamz wrote: Fri Sep 01, 2023 11:30 pmOh yeah I tried out the code and it worked! The only thing I'm confused about is why you multiplied the x values by 0.5?
To centre the position horizontally. The player's position is defined as its bottom centre. The horizontal centre is at the left corner plus half the width.
by pgimeno
Fri Sep 01, 2023 2:36 pm
Forum: Support and Development
Topic: I have been having problem's scaling the camera for my game
Replies: 4
Views: 1536

Re: I have been having problem's scaling the camera for my game

These are the changes that I've applied to your code, in diff format: $ diff -u main.lua.old main.lua.new --strip-trailing-cr --- main.lua.old 2023-09-01 08:09:02.000000000 +0200 +++ main.lua.new 2023-09-01 16:29:43.845043823 +0200 @@ -16,6 +16,7 @@ acc = 1000, maxSpeed = 500, factor = 1, + zoom = 3...
by pgimeno
Wed Aug 30, 2023 8:25 pm
Forum: Support and Development
Topic: Is there way to add a song to a queue?
Replies: 4
Views: 1095

Re: Is there way to add a song to a queue?

As darkfrei implies, for this purpose I'd suggest to use Source:isPlaying() in love.update and play the next when the current one stops playing, because you can certainly afford a one frame delay between songs, rather than going into the complications of queueable sources.
by pgimeno
Tue Aug 29, 2023 11:55 am
Forum: Support and Development
Topic: Help with love.filesystem.write
Replies: 1
Views: 778

Re: Help with love.filesystem.write

Löve can and will only write to save directories. Are you sure the folder "maps/" exists in the save directory? You can find out which directory is the save directory by placing this at the top of main.lua and observing the error message: error("The save directory is " .. love.fi...
by pgimeno
Sun Aug 27, 2023 6:31 am
Forum: Support and Development
Topic: Car Game
Replies: 3
Views: 1057

Re: Car Game

You can try loading the road image as ImageData instead of Image . You can then create an Image out of the ImageData, but also keep the ImageData because that way you can access ImageData:getPixel . So, instead of this: imageFile = love.graphics.newImage("img/carretera2.png") you'd do this...