tentus wrote:I'm about 20 minutes in and thought I'd post my thoughts so far. In love.load:
Code: Select all
for _,v in ipairs(img_fn) do
imgs[v]=love.graphics.newImage("assets/"..v..".gif")
end
-- Set filter to nearest
for _,v in pairs(imgs) do
v:setFilter("nearest","nearest")
end
why not just do:
Code: Select all
for _,v in ipairs(img_fn) do
imgs[v]=love.graphics.newImage("assets/"..v..".gif")
imgs[v]:setFilter("nearest","nearest")
end
In love.draw:
Code: Select all
-- Set color
love.graphics.setColor(bgcolor.r,bgcolor.g,bgcolor.b)
-- Draw rectangle for background
love.graphics.rectangle("fill",
0,0 ,love.graphics.getWidth(),love.graphics.getHeight())
-- Return the color back to normal.
love.graphics.setColor(255,255,255)
why not just do this in love.load?
Code: Select all
love.graphics.setBackgroundColor(bgcolor.r,bgcolor.g,bgcolor.b)
And, last but not least:
You always put draw and then update. I feel like this is misleading, update always gets called before draw (
source). It may not sound like an important distinction, but it'd be better to introduce people to the right way first, rather than having them come across very subtle anomalies down the road.
Every point you make is perfectly valid. At all of these points in the screen cast, I noticed exactly all of these issues, but I'd like to take them head on anyway:
For the v:setFilter:
I was doing that for a sense of clarity, if only to keep things a little clearer, but looking back, it makes more sense to just put them in the same loop. A Lua programmer is going to be asking the exact same thing, and it needs to be changed.
For the setBackgroundColor:
One of the things that was on my "list" of things to explain, was the love.graphics.rectangle, and I thought it might be nice to just draw a rectangle for that and skip the background color. In the next revision, I think I will use the setBackgroundColor, and then maybe the love.graphics.rectangle for a backdrop for the interface text.
As for the love.draw before the love.update, I noticed myself stumbling at multiple times on just this fact, and when i redo this, I plan on reversing the order in every instance.
One issue I had with the code, in retrospect, was the fact that I keep switching between 160*scale, 144*scale and love.graphics.getWidth(), love.graphics.getHeight() respectively. In the next version, I plan on using the love.graphics.get[Width|Height]() once, and then the [160|144]*scale for the rest. Do you feel as a viewer the switching confusing? Should I stick to the getWidth(), or keep using the scale variable?
Thanks tentus!