playdate
- https://stephanmax.com/playdate-development-neovim/
- https://github.com/sqwxl/playdate.nvim
- squidgod - youtube tutorials
- playdate LuaCATS
playdate sdk
screen basics
- screen size is 400x240
- sprites come has .png files, one bit (black and white)
- 32x32 px is a good/small sprite size (compared to 16x16)
- 30fps
screen coordinates
0,0 --> 400, 0
| |
| |
\/ \/
0, 240 --> 400, 240
main.lua
- everything outside of the update loop is implicit setup
- everything in the playdate function is called on every frame
-- 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:
game-development


characters