Search found 248 matches

by arampl
Sat Mar 21, 2015 1:44 am
Forum: General
Topic: So, I really like love and game development, but...
Replies: 7
Views: 1067

Re: So, I really like love and game development, but...

I am currently trying to create an algorithm for roguelike-style dungeon generation in Love2D http://donjon.bin.sh/d20/dungeon/ One of things that's currently bugging me is the lack of a continue statement in lua From PIL: "...A typical and well-behaved use of a goto is to simulate some constructio...
by arampl
Fri Mar 20, 2015 2:45 pm
Forum: Support and Development
Topic: Getting the center coordinates of the screen?????
Replies: 9
Views: 2206

Re: Getting the center coordinates of the screen?????

Correction: It is called depending on the current screen's set refresh rate; that can be anything the monitor supports Yeah, you're absolutely right. My bad. Edit: to answer the OP's question: love.graphics.draw(background, love.graphics.getWidth() /2 - background:getWidth() /2, love.graphics.getHe...
by arampl
Fri Mar 20, 2015 5:27 am
Forum: Support and Development
Topic: Getting the center coordinates of the screen?????
Replies: 9
Views: 2206

Re: Getting the center coordinates of the screen?????

To center text: function love.load() -- some of your loading code goes here... offw, offh = love.graphics.getDimensions() text = "Press Q to play." limit = 75 font = love.graphics.getFont() h = font:getHeight() _, lines = font:getWrap(text, limit) x, y = offw / 2 - limit / 2, offh / 2 - h * lines / ...
by arampl
Fri Mar 20, 2015 4:54 am
Forum: Support and Development
Topic: Getting the center coordinates of the screen?????
Replies: 9
Views: 2206

Re: Getting the center coordinates of the screen?????

First translate x = - imagewidth / 2, y = -height / 2, then scale, then translate x = screenwidth / 2, y = screenheight / 2.

Sorry. This is wrong. Please give me a moment.
by arampl
Fri Mar 20, 2015 3:28 am
Forum: Support and Development
Topic: Index a nil value
Replies: 2
Views: 463

Re: Index a nil value

To add new element to the table you can use "t[#t + 1] = {}" construct. So rewrite your code this way: tiles[#tiles + 1] = {} tiles[#tiles].x = editor.mousex tiles[#tiles].y = editor.mousey tiles[#tiles].id = editor.selected print("Successfully placed "..tiles[#tiles].id.." at "..tiles[#tiles].x..",...
by arampl
Thu Mar 19, 2015 9:01 am
Forum: Support and Development
Topic: [Solved]love.graphics.translate
Replies: 7
Views: 1100

Re: love.graphics.translate

That is a good explanation. Thank you!
by arampl
Thu Mar 19, 2015 6:15 am
Forum: Support and Development
Topic: [Solved]love.graphics.translate
Replies: 7
Views: 1100

Re: love.graphics.translate

then:

love.graphics.push()
love.graphics.translate(-math.floor(x), 0)
love.graphics.print....
love.graphics.pop()
love.graphics.translate(-x, 0)

It seems that for text you should use whole numbers, for drawing lines - +/- 0.5 to get sharp image.
by arampl
Thu Mar 19, 2015 6:06 am
Forum: Support and Development
Topic: [Solved]love.graphics.translate
Replies: 7
Views: 1100

Re: love.graphics.translate

Not sure if this is a good solution, but:

love.graphics.translate(-math.floor(x), 0)

will work.
by arampl
Mon Mar 16, 2015 12:07 am
Forum: Support and Development
Topic: How do I remove drawn images & printed text?
Replies: 21
Views: 2985

Re: How do I remove drawn images & printed text?

1. Don't put love.audio.play(theme) in love.draw(). Put it at the end of love.load(). 2. function love.draw() must be only one. --rename to main.lua -- character is DrForce function wait(time) -- so I do less typing and i feel familiar with it love.timer.sleep(time) end function love.load() -- LOAD ...
by arampl
Sat Mar 14, 2015 5:44 am
Forum: Support and Development
Topic: How do I remove drawn images & printed text?
Replies: 21
Views: 2985

Re: How do I remove drawn images & printed text?

Yes, you can. But why do you want to put love.draw() inside keyboard event?