Search found 1022 matches

by tentus
Wed May 02, 2012 5:09 pm
Forum: Support and Development
Topic: Math: Get Just the Sign
Replies: 3
Views: 1233

Math: Get Just the Sign

You know how math.abs returns a variable, sans its sign? Does anyone there a neat trick for doing the opposite, short of using the below:

Code: Select all

function sign(x)
  if x < 0 then
    return -1
  end
  return 1
end
(And before anyone suggests it, we do not want 0.)
by tentus
Fri Apr 27, 2012 3:12 pm
Forum: Support and Development
Topic: "Adding" a number to an variable
Replies: 12
Views: 2309

Re: "Adding" a number to an variable

It's very marginally faster to do the concat way (100,000 reps each comes to .066 seconds for the multiply and add, while it only took .044 for the concat). But beyond that I dunno. Source: function love.load() x = 0 sx = love.timer.getTime() for i=1,100000 do x = (x * 10) + 1 end ex = love.timer.ge...
by tentus
Wed Apr 25, 2012 11:54 pm
Forum: Support and Development
Topic: "Adding" a number to an variable
Replies: 12
Views: 2309

Re: "Adding" a number to an variable

You mean like this?

Code: Select all

function love.load()
	x = 0
end
function love.draw()
  love.graphics.print(x, 5, 5) 
end
function love.keyreleased(key)
	if tonumber(key) then
		x = (x * 10) + tonumber(key)
	end
end
by tentus
Mon Apr 23, 2012 2:39 am
Forum: Support and Development
Topic: Merging Physics Objects
Replies: 8
Views: 1489

Re: Merging Physics Objects

Edit 2: Solved the problem by changing the following line in love.draw: love.graphics.circle("fill", ball.body:getX(), ball.body:getY(), ball.shape:getRadius()) To this: love.graphics.circle("fill", ball.body:getX(), ball.body:getY(), ball.fixture:getShape():getRadius()) Wow, that is... not lovely....
by tentus
Sun Apr 22, 2012 2:10 pm
Forum: Support and Development
Topic: Not equals to (number to number)
Replies: 7
Views: 2194

Re: Not equals to (number to number)

mickeyjm wrote: Wont that be trur if x is larger than 16 OR less than 20 meaning that anything would return true
Eg. 5<20 therefore continue if statement
True.
by tentus
Sun Apr 22, 2012 1:57 pm
Forum: Support and Development
Topic: How do you make a Grid?
Replies: 4
Views: 1149

Re: How do you make a Grid?

Yep, you could use any number of numbers. You could so use letters with a tiny bit of modification. An example of having more numbers which render differently: function love.draw() love.graphics.rectangle("fill", player.act_x, player.act_y, 32, 32) for y=1, #map do for x=1, #map[y] do if map[y][x] =...
by tentus
Sun Apr 22, 2012 12:39 am
Forum: Support and Development
Topic: [DO NOT ANSWER, FOR I AM AN IDIOT]
Replies: 4
Views: 1437

Re: LUDUM DARE URGENT HELP

Did you just ask the internet to create a competition entry for you?
by tentus
Sat Apr 21, 2012 11:10 pm
Forum: Support and Development
Topic: help with animation
Replies: 11
Views: 2851

Re: help with animation

https://github.com/bartbes/love-misc-li ... L/AnAL.lua

Essentially, we make a quad from the frame sheet, and then render different parts of that quad depending on time passed.
by tentus
Wed Apr 18, 2012 4:49 pm
Forum: General
Topic: Retro Pixel Graphics: Which resolution would YOU use?
Replies: 7
Views: 6729

Re: Retro Pixel Graphics: Which resolution would YOU use?

I'm a fan of DOS original flavor, but as the others have said, DOS fake has a number of conveniences going for it. I'd go with one of those two.
by tentus
Wed Apr 18, 2012 12:23 am
Forum: Support and Development
Topic: Logo
Replies: 3
Views: 1011

Re: Logo

Could you take a screenshot of what you think the "love2d frame" is? Because I have no idea what you are referring to.