Page 2 of 2

Re: The Owls Massacre [v0.002]

Posted: Mon Jun 10, 2013 4:22 pm
by Johannes
One suggestion here: your laser value is showing up as some fairly long and ugly value sometimes, like 6.8149999999999997, when really 6.8 would be fine.

A quick and easy way to fix this, when you're drawing the text to the screen, just wrap your player.laser code in math.floor(). Or if you want to be more fancy, you can add a round function like this:

Code: Select all

function round(num, idp)
	local mult = 10^(idp or 0)
	return math.floor(num * mult + 0.5) / mult
end
which will allow you to choose how many values after the decimal point you want to show. So the usage here would be:

Code: Select all

love.graphics.print("Laser:".. round(player.laser,2), 0, 0)

Also it's generally best not to have spaces in filenames, since those tend to be replaced by ugly "%20" when downloaded.

So for example when I downloaded your 'The Owls Massacre.love' file, it was downloaded as 'The%20Owls%20Massacre.love'. Spaces also makes things complicated when trying to run files from a command line, since there you need to add an escape character \.

Instead of spaces, I would suggest just getting used to using underscores, like 'The_Owls_Massacre.love'.That way it will always display correctly and you'll avoid any possible issues :)

Re: The Owls Massacre [v0.002]

Posted: Mon Jun 10, 2013 4:52 pm
by bartbes
Personally, I'd go for using string.format, since it's the right tool for the job. In this case it would be ("Laser: %.1f"):format(player.laser).

Re: The Owls Massacre [v0.002]

Posted: Mon Jun 10, 2013 5:19 pm
by Kingdaro
bartbes wrote:Personally, I'd go for using string.format, since it's the right tool for the job. In this case it would be ("Laser: %.1f"):format(player.laser).
Eh. I prefer the syntax

Code: Select all

string.format("Laser: %.1f", player.laser)
It's a little longer, but cleaner in my opinion.

Re: The Owls Massacre [v0.002]

Posted: Mon Jun 10, 2013 5:23 pm
by Davidobot
Thanks for all the suggestions! :awesome:

Re: The Owls Massacre [v0.002]

Posted: Tue Jun 11, 2013 10:46 am
by Johannes
Kingdaro wrote:
bartbes wrote:Personally, I'd go for using string.format, since it's the right tool for the job. In this case it would be ("Laser: %.1f"):format(player.laser).
Eh. I prefer the syntax

Code: Select all

string.format("Laser: %.1f", player.laser)
It's a little longer, but cleaner in my opinion.
A cool. I'm a total LUA/Love newb so didn't know that you could write c-style string formatting with 'string.format'. Will use that in the future :)