## Search found 21 matches

Tue Oct 08, 2019 9:58 pm
Forum: General
Topic: Decrease velocity
Replies: 5
Views: 2449

### Re: Decrease velocity

Usually we call it friction.
Here's a simple way to do it:

Code: Select all

player.xVel = player.xVel * (1 - math.min(player.friction*dt, 1))
Fri Jan 25, 2019 12:42 am
Forum: Support and Development
Topic: Can't get accurate trajectory predictions with Box2d
Replies: 2
Views: 1323

### Re: Can't get accurate trajectory predictions with Box2d

Thanks! Turns out the bigger the meter the more accurate my prediction will be up to a certain extent.
Thu Jan 24, 2019 7:02 pm
Forum: Support and Development
Topic: Can't get accurate trajectory predictions with Box2d
Replies: 2
Views: 1323

### Can't get accurate trajectory predictions with Box2d

As the title says the trajectories that I predict don't line up with the path that the body ends up taking. I'd also like to note that the innacuracy is proportional to the gravity. (world.lua line 8) I'm attaching the .love file but please note that it's for v0.10.2. Sorry for all the bad code, any...
Tue Jan 22, 2019 6:26 pm
Forum: Support and Development
Topic: Using a single return value of a fucntion
Replies: 6
Views: 1815

### Re: Using a single return value of a fucntion

Thanks everyone! Very useful!
Tue Jan 22, 2019 5:14 pm
Forum: Support and Development
Topic: Using a single return value of a fucntion
Replies: 6
Views: 1815

### Using a single return value of a fucntion

How do I get the n-th return value of a function with multiple return values?

Here's something that doesn't work:

Code: Select all

function foo()
return 1, 2, 3
end

two = {foo()}[2]

Mon Aug 21, 2017 10:21 am
Forum: Support and Development
Topic: Functions in a table [SOLVED]
Replies: 3
Views: 801

### Re: Functions in a table

Yes, there is! function map.setLvl(n) map['load' .. n]() end You need to use the [] notation for tables, and concatenate the first part of the key with the index, then call that value which is the function returned by that expression. Wow, crazy. Thanks for the help. I always knew there was a bette...
Mon Aug 21, 2017 9:58 am
Forum: Support and Development
Topic: Functions in a table [SOLVED]
Replies: 3
Views: 801

### Functions in a table [SOLVED]

Is there a more elegant way of doing this?

Code: Select all

function map.setLvl(n)
if n == 0 then
elseif n == 1 then
elseif n == 2 then
elseif n == 3 then
end
end

This doesn't work

Code: Select all

function map.setLvl(n)
end

Wed Apr 27, 2016 9:10 pm
Forum: Support and Development
Replies: 6
Views: 1032

### Re: Audio restarts after love.load()

zorg wrote:Neat gorilla.bas remake though.
Oh my god! I didnt even know this game existed! This is awesome! Thanks for your help anyway, I still can do something stupid like that play call in update, so it definetly helps to have someone point that out
Wed Apr 27, 2016 8:33 pm
Forum: Support and Development
Replies: 6
Views: 1032

### Re: Audio restarts after love.load()

if anything, some audio functionality has changed between 0.9 and 0.10, so i'd check love.audio on the wiki. In more detail, playing/paused/stopped states have been messed with, so it can work differently. Me asking you for your love.load function still stands though. This is a pretty messy pile of...
Wed Apr 27, 2016 7:52 pm
Forum: Support and Development