Page 26 of 91
Re: "Questions that don't deserve their own thread" thread
Posted: Sat Nov 15, 2014 4:29 pm
by micha
Ulydev wrote:When you're in-game, try to make a smooth circle around the edges of the grey/black zone like you would do with mouse controls. It's actually impossible, is there any way to make it smoother ?
Instead of putting the circle back to the previous position you have to move it to the point inside the circle that is closest to the new position. This is exactly what you also do for the mouse control. For example you could do this:
Code: Select all
local distance = math.sqrt(math.pow(480-objects.ball.x, 2)+math.pow(320-objects.ball.y, 2))
if distance > objects.zone.radius then
objects.ball.x = 480 + (objects.ball.x-480) * objects.zone.radius / distance
objects.ball.y = 320 + (objects.ball.y-320) * objects.zone.radius / distance
end
Here is the corrected .love.
Re: "Questions that don't deserve their own thread" thread
Posted: Sat Nov 15, 2014 7:19 pm
by Ulydev
Thank you, my saviour
Re: "Questions that don't deserve their own thread" thread
Posted: Sun Nov 16, 2014 12:17 am
by parallax7d
could someone give me some pointers at to what this bit of code does?
Code: Select all
local _PATH = (...):match('^(.*[%./])[^%.%/]+$') or ''
it can be found on line 27 in the hump camera library.
https://github.com/vrld/hump/blob/master/camera.lua
Re: "Questions that don't deserve their own thread" thread
Posted: Sun Nov 16, 2014 5:37 am
by josefnpat
Re: "Questions that don't deserve their own thread" thread
Posted: Sun Nov 16, 2014 6:35 am
by parallax7d
thanks, you put me on the right track but i'm still not getting it. Kikito claims that (...) is documented, but i just don't see it. I also can't replicate what he's claiming in the interactive interpreter if i run this:
Code: Select all
> require ("gameState"); print (...)
i get a blank line from stdout
Re: "Questions that don't deserve their own thread" thread
Posted: Sun Nov 16, 2014 11:53 am
by bartbes
parallax7d wrote:Kikito claims that (...) is documented, but i just don't see it.
See [manual]require[/manual], in particular:
Once a loader is found, require calls the loader with a single argument, modname.
... accesses all (unnamed) arguments to a function, a file acting like a function. Then surrounding it in parentheses collapses it to only the first argument, the modname as specified above.
parallax7d wrote:I also can't replicate what he's claiming in the interactive interpreter if i run this:
Code: Select all
> require ("gameState"); print (...)
Because it's defined
in the required file, not outside it. (Actually, it just means that that line of code was called without arguments, but that's very much an implementation detail of the interpreter. The vararg expression is defined everywhere, there's just not always arguments.)
Re: "Questions that don't deserve their own thread" thread
Posted: Tue Nov 18, 2014 8:15 pm
by IceQB
I have simple question, use vsync or not use?
Re: "Questions that don't deserve their own thread" thread
Posted: Tue Nov 18, 2014 8:19 pm
by Nixola
Some will say "use it", some will say "don't". Best answer: let the user decide. Vsync prevents screen tearing, but in some pc it can somehow cause weird input lag.
Re: "Questions that don't deserve their own thread" thread
Posted: Wed Nov 19, 2014 12:58 am
by undef
I would turn it on on default though... Games can look really ugly without it at times.
Re: "Questions that don't deserve their own thread" thread
Posted: Sun Nov 23, 2014 8:05 pm
by Ranguna259
I've got another shader problem, I created an extern image called map and then I use that image in the effect function of the shader code but whenever I try to send the image to the shader it says "Variable 'map' does not exist", but it does.
Here's the .love file: