Search found 1949 matches

by pgimeno
Wed Jan 29, 2020 1:33 am
Forum: Support and Development
Topic: Trouble returning tables from a separate file
Replies: 3
Views: 50

Re: Trouble returning tables from a separate file

map[2] = That's not a valid key. Maybe you meant this? map = { 0,1,1,1,0,1,1,2, 0,1,0,1,0,1,0,0, 0,0,1,1,0,1,1,1, 1,1,1,0,1,1,0,1, 1,0,1,1,0,1,1,0, 1,1,1,0,0,1,0,1, 0,1,0,1,1,1,1,1, 1,1,1,1,0,1,1,0, desc="Corridor", chest=false, trap=false, rate=0 } This way, yourtable.map[1] = 0, yourtable.map[2] ...
by pgimeno
Wed Jan 29, 2020 1:30 am
Forum: Support and Development
Topic: Platformer state in a top-down RPG
Replies: 3
Views: 133

Re: Platformer state in a top-down RPG

If your problem is the state switching, there are libraries for handling a stack of states, allowing you to just change state, or to push current state to the stack and then change, or to pop a state from the stack if it was previously pushed. Take a look at https://love2d.org/forums/viewtopic.php?f...
by pgimeno
Wed Jan 29, 2020 1:12 am
Forum: Support and Development
Topic: How do I install on Linux system?
Replies: 4
Views: 67

Re: How do I install on Linux system?

What's your graphics card? Do you have GL drivers for it? Does glxgears work for you? Also, the output of: 'glxinfo | grep string' (without the quotes) would be useful. Both are in package mesa-utils. Edit: swrast is the software rasterizer (software OpenGL). That sounds like you don't have drivers ...
by pgimeno
Tue Jan 28, 2020 1:28 am
Forum: Support and Development
Topic: Platformer state in a top-down RPG
Replies: 3
Views: 133

Re: Platformer state in a top-down RPG

I'd say the main issue with a platformer is handling collisions. You could perhaps handle them yourself, if you dare, but I don't recommend that, as they are a bit more complicated than they may seem at first sight. You could use love.physics for that, but then you need to handle every object throug...
by pgimeno
Sun Jan 26, 2020 6:52 pm
Forum: Support and Development
Topic: event.quit() [solved]
Replies: 5
Views: 107

Re: event.quit()

There are several other things that can cause this (like calling love.event.poll yourself, or causing a hang before the next frame, or overriding love.run wrongly) but it's very hard to say if you don't show the code.
by pgimeno
Fri Jan 24, 2020 3:15 pm
Forum: Support and Development
Topic: Timer to end game
Replies: 1
Views: 143

Re: Timer to end game

You can use a timer library or make your own. If you decide to use one, hump.timer is good. It can be overkill for just one timer, though, so if you decide to make your own, it's easy. Have a variable that tells if the timer is active. If it is, accumulate dt in another variable until the value exce...
by pgimeno
Tue Jan 21, 2020 12:39 am
Forum: General
Topic: Collision not working
Replies: 3
Views: 207

Re: Collision not working

It was a bit difficult to get the program to work for me. I had to find my copy of dkjson.lua and copy it as Json.lua, and enable it at the top, otherwise I got a nil indexing error on the Json global. Then I had another problem with the case of the directories. Once in the .love file, they are case...
by pgimeno
Sun Jan 19, 2020 9:40 pm
Forum: General
Topic: How do you calculate shooting vector [Solved]
Replies: 3
Views: 191

Re: How do you calculate shooting vector

You don't need atan2 for that though. You can use the vector length formula: local function vector_length(x, y) return math.sqrt(x^2+y^2) end Now, the vector from the enemy to the player is given by (player - enemy), that's player.x - enemy.x, player.y - enemy.y. Divide that by its length: local vx ...
by pgimeno
Sun Jan 19, 2020 2:03 pm
Forum: Support and Development
Topic: requiring c module crashes love
Replies: 4
Views: 285

Re: requiring c module crashes love

Maybe try with FFI? It may also have the additional benefit of not slowing down your program.
by pgimeno
Sun Jan 19, 2020 1:03 pm
Forum: Support and Development
Topic: Deterministic ln(x) approximation
Replies: 12
Views: 915

Re: Deterministic ln(x) approximation

Glad you got it working :) leaves me with some serious error magnification too. Since you do 15 iterations, the lowest term you're adding is 0.00003051711247318638 so that's the best error you can aspire to in the logarithm. That of course propagates exponentially when you take the exp(). You can ad...