Search code examples
canvaslua2dgame-enginelove2d

Love2d canvas, blury character sprite


I developed a 2d engine using love2d (lua), drawing sprites wasn't a problem. Due to messy code, I had to recode everything.

I have now the same engine with a cleaner code. I wasnt drawing in a canvas and had performance problem.

Now everything is fine, displayed in my canvas.But only my charset is blury. I did not resized / rescaled everything so I dont understand why it does happen.

I cant show a minimal code but at the end of the day, despite all game objects im just drawing with : love.graphics.draw( image, quad, x, y )

it is blury :/

Edit : it start not blurry, it happens when I start to move my character(and then never goes away). But i just change x and y when I does that...

Edit2 : the more i move my character the less it is blury (i mean it stops when i move a bit my character. My animation timer arent refreshed when there is only one frame ( like idle animations ). But i dont know how it could be related... there is no redraw when i animate, i just change the frame index.. Im confuse


Solution

  • Did you set the FilterMode? After creating your image or canvas you should set the FilterMode to "Nearest", "Nearest" for pixelized scaling:

    local image = love.graphics.newImage("ball.png")
    image:setFilterMode("nearest", "nearest")
    

    http://love2d.org/wiki/FilterMode