From f92e88b5548bad697122f493a6c57389227ef7e5 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Fri, 28 Feb 2025 14:05:37 +0100 Subject: [PATCH] add tilemap --- src/img/tilemap-table-16-16.png | Bin 0 -> 133 bytes src/img/tilemap.pxo | Bin 0 -> 621 bytes src/main.lua | 29 ++++++++--------------------- 3 files changed, 8 insertions(+), 21 deletions(-) create mode 100644 src/img/tilemap-table-16-16.png create mode 100644 src/img/tilemap.pxo diff --git a/src/img/tilemap-table-16-16.png b/src/img/tilemap-table-16-16.png new file mode 100644 index 0000000000000000000000000000000000000000..dc72c465c90c887a69385fcaac1575d0a06c6564 GIT binary patch literal 133 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANL}jKx9jP7LeL$-HD>V6gXe zaSVxQeS1-xk3oTl^hVvgARjVuYh!DK>9$nqF5#!|V}(6BqWCs^GT3bVm|G_Hx&M=eKde$5noadO zqO^pz7V5HTn4Lc^72U+dbY3^=#DZ-;_dZ`YoK&J0FliUBF6$Zt1(E65Y{!x`om-U7 zKhRmSE+gTm_WQL~?T%8mPToOGv;D$0JGM@|bTl)2q zcNx2Df$UP2^WAG?JS6kDUC$>TyK&+9>$AUdpE9ed{WqDxe(I&n)g!CDgf<;bTX*=h zF{fVP_PNh2&Tf1zt)vK6}M|6TJ(yd(MC z@yZ&3f41{;O6SelA<8&sqr2{3&DfiFpFRA=jT+`V<&RF&Vqjok5MW@CW?*2*%uP&B zjR%Fiep*ptZfdc = playdate.graphics --- Here's our player sprite declaration. We'll scope it to this file because --- several functions need to access it. - local playerSprite = nil --- A function to set up our game environment. - function myGameSetUp() - -- Set up the player sprite. - local playerImage = gfx.image.new("img/player.png") - assert(playerImage) -- make sure the image was where we thought + assert(playerImage) playerSprite = gfx.sprite.new(playerImage) - playerSprite:moveTo(200, 120) -- this is where the center of the sprite is placed; (200,120) is the center of the Playdate screen - playerSprite:add() -- This is critical! + playerSprite:moveTo(200, 120) -- (200,120) is the center of the Playdate screen + playerSprite:add() -- We want an environment displayed behind our sprite. -- There are generally two ways to do this: @@ -50,6 +32,11 @@ function myGameSetUp() -- backgroundImage:draw(0, 0) -- end -- ) + + local table = gfx.imagetable.new("img/tilemap-table-16-16.png") + local map = gfx.tilemap.new() + map:setImageTable(table) + map:draw(0, 0) end -- Now we'll call the function above to configure our game.