local pd = playdate local gfx = playdate.graphics class("BackGround").extends() function BackGround:init(x, y) gfx.sprite.setBackgroundDrawingCallback( function (x, y, width, height) local groundImage = playdate.graphics.image.new("sprites/bg") gfx.setClipRect(x, y, width, height) groundImage:draw(0,0) gfx.clearClipRect() end ) end