"Questions that don't deserve their own thread" thread

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Locked
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: "Questions that don't deserve their own thread" thread

Post 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.
Attachments
keyboard.love
(57.88 KiB) Downloaded 120 times
User avatar
Ulydev
Party member
Posts: 445
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by Ulydev »

Thank you, my saviour :awesome:
User avatar
parallax7d
Citizen
Posts: 82
Joined: Wed Jul 02, 2014 11:44 pm

Re: "Questions that don't deserve their own thread" thread

Post 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
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by josefnpat »

parallax7d wrote: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
http://kiki.to/blog/2014/04/12/rule-5-b ... ple-files/
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
User avatar
parallax7d
Citizen
Posts: 82
Joined: Wed Jul 02, 2014 11:44 pm

Re: "Questions that don't deserve their own thread" thread

Post 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
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: "Questions that don't deserve their own thread" thread

Post 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.)
User avatar
IceQB
Citizen
Posts: 67
Joined: Sat Nov 03, 2012 1:11 pm

Re: "Questions that don't deserve their own thread" thread

Post by IceQB »

I have simple question, use vsync or not use?
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: "Questions that don't deserve their own thread" thread

Post 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.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by undef »

I would turn it on on default though... Games can look really ugly without it at times.
twitter | steam | indieDB

Check out quadrant on Steam!
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: "Questions that don't deserve their own thread" thread

Post 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:
shader.love
(617 Bytes) Downloaded 138 times
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
Locked

Who is online

Users browsing this forum: Google [Bot] and 2 guests