I think the problem here is the line coordinates being out of the sprite bounds.
From the Inside Playdate documentation for playdate.graphics.sprite:draw(x, y, width, height)
:
The rect passed in is the current dirty rect being updated by the display list. The rect coordinates passed in are relative to the sprite itself (i.e. x = 0, y = 0 refers to the top left corner of the sprite).
Using playdate.getCrankPosition() / 4
to set the sprite size you can at most get an 89.75x89.75 sprite (359 / 4), and coordinates used in the sprite draw function are relative to the sprite itself; so drawing a line from (150,100) to (150,20) in the sprite draw function would not change any pixels in the portion of the screen being updated via that call.
If you change howHard:draw()
to:
function howHard:draw(x, y, w, h)
gfx.drawLine(x, y, x + w, y + h)
gfx.drawRect(x, y, w, h)
end
you can show the boundaries of the dirty rect being updated in the draw call (with a line across it for good measure):
That's basically where the sprite is, and to draw outside of it you'd have to call draw functions in other parts of your code (e.g., if gfx.drawLine(150, 100, 150, 20)
is meant to refer to screen coordinates, calling it somewhere in playdate.update()
will draw a line on that part of the screen).
Edit: sorry @scratchminer, I had missed that you had already said basically the same in shorter form...