Search found 2602 matches

by pgimeno
Tue Apr 20, 2021 10:56 am
Forum: Support and Development
Topic: [SOLVED] Changing frequency while synthesising sine wave
Replies: 7
Views: 1439

Re: Changing frequency while synthesising sine wave

This seems to work: return function(freq) phase = phase + tau * increment * freq generator.phase = phase return math.sin(phase) end Why is it different, I haven't stopped to analyse yet. By the way, you can save a multiplication by pre-calculating tau * increment. Edit: Intuitively, the phase shift ...
by pgimeno
Tue Apr 20, 2021 10:24 am
Forum: Support and Development
Topic: String to access nested table value.
Replies: 7
Views: 1332

Re: String to access nested table value.

It's weird to have movement defined in such a file. Usually, movement needs custom logic - handling collisions, at least. There may be types of movements that you handle separately, but I'd rather have a field "movement_type" or something like that for these cases. Then your code would hav...
by pgimeno
Mon Apr 19, 2021 7:40 pm
Forum: Support and Development
Topic: I'm about to make my own keyboard layout maps
Replies: 3
Views: 1031

Re: I'm about to make my own keyboard layout maps

What I'm currently doing is use keypressed/keyreleased for all non-character keys. This works flawlessly. And textinput + setKeyRepeat for everything else - the first char of the text is my key and it is considered pressed until the emulated system is done polling the keyboard once. That works well...
by pgimeno
Mon Apr 19, 2021 7:07 pm
Forum: Support and Development
Topic: Efficiently drawing a grid map
Replies: 19
Views: 3199

Re: Efficiently drawing a grid map

I thought sprite batching became automatic in Love a few versions ago? Am I mistaken about what that meant? I mention that later on. https://love2d.org/forums/viewtopic.php?p=240186#p240186 Manual batching is still available. As I mention in that post, I'm not sure whether it improves performance o...
by pgimeno
Mon Apr 19, 2021 6:28 pm
Forum: Support and Development
Topic: I'm about to make my own keyboard layout maps
Replies: 3
Views: 1031

Re: I'm about to make my own keyboard layout maps

Whew, have you peeked down that rabbit hole and noticed its depth? Android does not generate accurate key down/up events. I don't remember the details but I think it generated both at the same time, or did not generate one of them, or something like that. IIRC it also generated textinput before keyp...
by pgimeno
Mon Apr 19, 2021 5:07 pm
Forum: Support and Development
Topic: String to access nested table value.
Replies: 7
Views: 1332

Re: String to access nested table value.

There isn't a direct route. At best, you can make a function to do this kind of access, but it's not the path I'd recommend to follow: local function nested(table, index) for s in index:gmatch("[^%.]+") do table = table[s] end return table end local t = {x=0, y=5, other={z=10}} local zprop...
by pgimeno
Sun Apr 18, 2021 6:24 pm
Forum: Support and Development
Topic: Efficiently drawing a grid map
Replies: 19
Views: 3199

Re: Efficiently drawing a grid map

No idea of how your project is structured. But you mentioned a grid, so I imagine that the images to draw in that grid are all of the same size. Create an image whose sides are multiples of the horizontal and vertical size respectively, of the images to include, that is able to fit all the images. T...
by pgimeno
Sun Apr 18, 2021 12:07 pm
Forum: General
Topic: My Function isn't activating, please help
Replies: 2
Views: 1010

Re: My Function isn't activating, please help

I am trying to make a flappy bird replica but my "createrec" function does not seem to work... It is very possible that it is a different problem because as my name suggests, I am very bad. This is the code: function love.load() love.physics.setMeter(64) world = love.physics.newWorld(0, 9...
by pgimeno
Sun Apr 18, 2021 11:56 am
Forum: Support and Development
Topic: Efficiently drawing a grid map
Replies: 19
Views: 3199

Re: Efficiently drawing a grid map

You can certainly generate the atlas at load time, if that's what you're asking. Even a canvas would work.
by pgimeno
Sun Apr 18, 2021 2:19 am
Forum: Support and Development
Topic: Efficiently drawing a grid map
Replies: 19
Views: 3199

Re: Efficiently drawing a grid map

If you had a dungeon crawler that doesn't scroll very fast, would it help to draw all the floor tiles first then all the walls then all the doors etc? In other words, don't blindly draw left to right and causing a lot of swapping? If you have all floor tiles in a single texture atlas, all the walls...