Search found 1035 matches

by tentus
Sun Mar 11, 2018 7:32 pm
Forum: Support and Development
Topic: Change default font?
Replies: 6
Views: 7165

Re: Change default font?

The cross-section of universally available fonts is laughable, so you're best off distributing your fonts with your project. For some code examples to get you going, probably start here:
https://love2d.org/wiki/love.graphics.newFont
by tentus
Sat Mar 10, 2018 7:50 pm
Forum: General
Topic: LOVE users map
Replies: 182
Views: 117843

Re: LOVE users map

Charlottesville, Virginia, USA
by tentus
Thu Mar 08, 2018 11:07 pm
Forum: Support and Development
Topic: Best way to index out-of-bounds?
Replies: 8
Views: 4542

Re: Best way to index out-of-bounds?

In my last game I used the first tile of the map as a default, and drew a screen-sized spritebatch of it underneath the map, modulo'd to the same partial tile offset as the player. What this mean was that even we were looking over the edge of the map (or even if the map had partially transparent til...
by tentus
Wed May 02, 2012 5:09 pm
Forum: Support and Development
Topic: Math: Get Just the Sign
Replies: 3
Views: 3755

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: 8648

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: 8648

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: 5024

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, th...
by tentus
Sun Apr 22, 2012 2:10 pm
Forum: Support and Development
Topic: Not equals to (number to number)
Replies: 7
Views: 7588

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: 6106

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 m...
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: 3438

Re: LUDUM DARE URGENT HELP

Did you just ask the internet to create a competition entry for you?