Category: code

  • Playdate 10

    A small update this time around. Having two ghosts chase one other identical ghost around the maze was getting a bit silly, so time for a player character. I drew up a quick puck-man in Resprite, with three frames per direction: .. and loaded that in as puckTable: Then, when setting up the player sprite,…

  • Playdate 9

    In day 8 I added an enemy ghost, but one with no brain – it just bumbled randomly around the maze: Time for some very simple AI. In real Pacman the three ghosts have different chasing strategies, but I thought I’d go for something very simple, from first principles – a ghost that chases straight…

  • Playdate 8

    I’ve been a bit distracted this week, wrangling Safari extensions in Xcode, but now back to the maze. Today I wanted to get an enemy moving around on its own. Things I learned doing this: First, you can do a test for boolean true or false – but there’s no === operator, and lots of…

  • Playdate 7

    After a bit of a break to update some code for Make America Kittens Again and submit that to the Mac App Store, back to the little Pacman game. Today: time to put the ghost back in motion. The key thing here is a function to check whether a given direction is a possible way…

  • Playdate 6

    When all else fails and there’s nothing you can do: keep busy, I guess? So, building on yesterday’s demo, I wanted to make my little ghost eat the dots as it passes over them. First step is working out when the ghost – which is moving in increments of 4px – has entered a new…

  • Playdate 5

    No *you’re* trying to distract yourself from the news. Not a big one this time. Added a proper level, drawn out as a table: .. and I updated the background PNG to match, with a wall, a blank space, and a space with a dot. It seems to make more sense to have the dots…

  • Playdate 4

    Having worked out how to draw a sprite, and then a background, it had to be time to put them together. My first attempt at this didn’t work at all – all I got was the background, no sprite – until I learned that I need to convert my TileMap to a sprite also: ..…

  • Playdate 3

    Having got everything running and tested a Pacman-style sprite, I figure the next step is to learn how to draw backgrounds. I already know how to load an image in as the backdrop, but what about a grid-style background made of tiles? The Playdate SDK has a Tilemap object, but not much sample code. Fortunately…

  • Playdate 2

    Now the simulator’s running and we can get something on screen, let’s try for some simple pac-man like sprite controls. First, the background image. Skipped this yesterday. Made a 400×240 black and white image, saved as a PNG in Photoshop, then called that in using the sample code: That works – but my sprite is…