metasyn icon navigation icon
pastel rainbow stripes

playdate

playdate sdk

screen basics

screen coordinates

0,0     --> 400, 0

 |            |
 |            |
 \/           \/

0, 240  --> 400, 240

main.lua

-- setup
local pd = =playdate
local gfx = pd.graphics


function pd.update()
  -- core loop
end

sprites

import "CoreLibs/sprites"

-- create new image / sprite
local image = gfx.image.new("images/something")
local sprite = gfx.sprite.new(image)

-- set a collision rectangle, often smaller than image
sprite.setCollideRect(0, 0, 64, 48)
sprite.moveTo(40, 120)

-- add sprite to list of sprites to animate/render
sprite.add()


function pd.update()
  -- update sprites
  gfx.sprite.update()

  -- do something with sprite
  sprite:moveBy(0, -10)
end

drawing text

import "CoreLibs/graphics"

gfx.drawText("text", x, y)
gfx.drawText("text", x, y, kTextAlignment.center)

checking inputs

if pd.buttonJustPressed(pd.kButtonA) then
    -- do something
end

referenced by: icon representing the epistemic certainty of the linked pagegame-development

last updated:

2026.03.30