arbaces wrote:
I know that double posting is super evil and bartbes is going to kick my butt, but here I go...
Then why? You could've easily edited the previous post!
Sorry, I didn't know I could edit posts after posting. >.<
Kadoba wrote:This sounds like it's the image filter. By default the image filter is set to linear which blurs the image when scaled. You probably want the filter to be set to nearest. Just set the image of the character image using image:setFilter("nearest", "nearest"). Or you can set this as the default filter by using love.graphics.setDefaultImageFilter("nearest","nearest").
Thanks so much! This fixed that problem.
Kadoba wrote:Arbaces wrote:- If you set global.scale to values which aren't integer numbers divided by five, then there are sometimes horizontal and vertical lines. I assume these are seams because the ground's tiles aren't being scaled to the exact number of pixels needed, but I don't understand some of the logic in ATL yet. Is it possible to adjust the code such that the tiles won't have these seams?
That's not quite an ATL thing. Scaling is the culprit though. When you draw with decimal coordinates then the image isn't guaranteed to "fit" together. The easiest fix for this is to render what you want on a canvas at 1:1 scaling and then scale the canvas up and down.
Is there a reason that this canvas method isn't the default behavior of ATL?
If it's something you would include, but didn't want to spend time on, I can try to put something together. My initial attempts were lackluster:
When I set aside a small canvas, it works! but only draws the top left corner of the map. There is no horizontal or vertical black lines for any scale that I tried. (This is on my game which runs ATL 0.9.0 on a modified version of the desert map)
I then tried to set aside a large canvas (8192x8192). For some reason, when I boot the game with this, my macbook's mother board turns on the blinking warning lights/warning beep and the computer becomes unresponsive until forced to hard reboot... That's somewhat frightening.
This is what I do in particular:
At the top of the file:
Code: Select all
canvas = love.graphics.newCanvas()
DesertExample.draw():
Code: Select all
-- Called from love.draw()
function DesertExample.draw()
-- Set sprite batches if they are different than the settings.
map.useSpriteBatch = global.useBatch
if map[currentMap] == nil then
-- Cut out unimportant stuff here
return
end
love.graphics.setCanvas( canvas )
-- Limit the draw range
if global.limitDrawing then
map[currentMap]:autoDrawRange(ftx, fty, global.scale, -100)
else
map[currentMap]:autoDrawRange(ftx, fty, global.scale, 50)
end
-- Queue our char to be drawn after the tile he's on and then draw the map.
local maxDraw = global.benchmark and 20 or 1
for i=1,maxDraw do
map[currentMap]:draw()
end
love.graphics.setCanvas()
-- Scale and translate the game screen for map drawing
local ftx, fty = math.floor(global.tx), math.floor(global.ty)
love.graphics.push()
love.graphics.scale(global.scale)
love.graphics.translate(ftx, fty)
love.graphics.draw(canvas)
canvas:clear()
-- Reset the scale and translation.
love.graphics.pop()
if map[currentMap].filter ~= nil then
love.graphics.draw(map[currentMap].filter)
end
HUD.draw()
end