I’ve not spent a great deal of time with games and found the sprite sheets difficult to navigate so I’ve written a couple of programs to assist finding suitable sprites from the sprite and tile sheets provided.
The single version just allows the user to move about the sheet to see one sprite at a time.
# Show single sprite Tufty 2040
# Tony Goodhew 26th June 2022
import utime
import random
from pimoroni import Button
from picographics import PicoGraphics, DISPLAY_TUFTY_2040
display = PicoGraphics(display=DISPLAY_TUFTY_2040)
WIDTH, HEIGHT = display.get_bounds()
# Load the spritsheets so we can flip between them
tilemap = bytearray(128 * 128)
open("s4m_ur4i-pirate-tilemap.rgb332", "rb").readinto(tilemap)
character = bytearray(128 * 128)
open("s4m_ur4i-pirate-characters.rgb332", "rb").readinto(character)
display.set_spritesheet(character) # Pick either
#display.set_spritesheet(tilemap)
display.set_pen(255)
display.clear()
display.update()
display.set_font("bitmap8")
button_a = Button(7, invert=False)
button_b = Button(8, invert=False)
button_c = Button(9, invert=False)
button_up = Button(22, invert=False)
button_down = Button(6, invert=False)
x = 0
y = 0
running = True
while running:
if button_a.is_pressed:
x = x - 1
if x < 0:
x = 0
elif button_c.is_pressed:
x = x + 1
if x > 15:
x = 15
elif button_up.is_pressed:
y = y - 1
if y < 0:
y = 0
elif button_down.is_pressed:
y = y + 1
if y > 15:
y = 15
elif button_b.is_pressed:
running = False
# print(x,y)
display.set_pen(255)
display.clear()
display.sprite(x,y,2,2,8)
display.text("X: "+str(x),20,120,320,2)
display.text("Y: "+str(y),20,140,320,2)
display.update()
utime.sleep(0.15)
print("Done")
display.set_pen(0)
display.clear()
display.update()
The second helps identify groups of sprites/tiles which can be used together.
You can see the frame and a pair of skulls in the picture. Not too sure what some of the other sets represent.
Just use the UP/ DOWN buttons for Y and A/C for X. B halts the program.
# Show 12 tiles/sprites as positioned on a sheet
# Tony Goodhew 26th June 2022
import utime
import random
from pimoroni import Button
from picographics import PicoGraphics, DISPLAY_TUFTY_2040
display = PicoGraphics(display=DISPLAY_TUFTY_2040)
WIDTH, HEIGHT = display.get_bounds()
# Load the spritsheets so we can flip between them
tilemap = bytearray(128 * 128)
open("s4m_ur4i-pirate-tilemap.rgb332", "rb").readinto(tilemap)
character = bytearray(128 * 128)
open("s4m_ur4i-pirate-characters.rgb332", "rb").readinto(character)
display.set_spritesheet(character) # Pick either
#display.set_spritesheet(tilemap)
display.set_pen(255)
display.clear()
display.update()
display.set_font("bitmap8")
button_a = Button(7, invert=False)
button_b = Button(8, invert=False)
button_c = Button(9, invert=False)
button_up = Button(22, invert=False)
button_down = Button(6, invert=False)
x = 0
y = 0
running = True
while running:
if button_a.is_pressed:
x = x - 1
if x < 0:
x = 0
elif button_c.is_pressed:
x = x + 1
if x > 12:
x = 12
elif button_up.is_pressed:
y = y - 1
if y < 0:
y = 0
elif button_down.is_pressed:
y = y + 1
if y > 13:
y = 13
elif button_b.is_pressed:
running = False
# print(x,y)
display.set_pen(255)
display.clear()
display.sprite(x,y,2,30,8)
display.sprite(x+1,y,66,30,8)
display.sprite(x+2,y,130,30,8)
display.sprite(x+3,y,194,30,8)
display.sprite(x,y+1,2,94,8)
display.sprite(x+1,y+1,66,94,8)
display.sprite(x+2,y+1,130,94,8)
display.sprite(x+3,y+1,194,94,8)
display.sprite(x,y+2,2,158,8)
display.sprite(x+1,y+2,66,158,8)
display.sprite(x+2,y+2,130,158,8)
display.sprite(x+3,y+2,194,158,8)
display.text("X: "+str(x),4,5,320,2)
display.text(str(x+1),90,5,320,2)
display.text(str(x+2),158,5,320,2)
display.text(str(x+3),222,5,320,2)
display.text("Y",280,5,320,2)
display.text(str(y),280,68,320,2)
display.text(str(y+1),280,130,320,2)
display.text(str(y+2),280,190,320,2)
display.update()
utime.sleep(0.15)
print("Done")
display.set_pen(0)
display.clear()
display.update()
I hope you find these useful - have fun - great board.
Tony