PocketCHIP touchscreen controls

Published 2023-06-12


This is one that only PocketCHIP people will be able to test and use.

By chance, I discovered that the mouse click (touchscreen) detection in Pico-8 looks at the entire screen on the PocketCHIP, not just the 128x128 viewport of the game.

So while the player will always only see the 128x128 box in the middle of the screen, you can detect when the person touches the screen to the left or right of that 128px box. So by all rights, you can make a Pico-8 game that uses touchscreen controls without requiring the player to touch the game screen area.

The width of the PocketCHIP screen is 480px total, so after some quick napkin math, I figured that there's about 176 pixels on each side. I made 2 collision boxes on either side of the game viewport (so -176 and 128, with a width of 176 and height of 127)

Then just a normal collision script combined with the handy mouse click detection function and boom, you have touch controls for your game.

The cart above just moves the little guy left/right and that's it - just proof of concept. Again, you'll have to try it on your PocketCHIP. This doesn't seem to work with the Pico8 client (at least on Windows)...even if you make your window super wide, it won't register the click.

Here's a YouTube video of it in action (couldn't figure out embedding):
https://www.youtube.com/watch?v=ogQWORouAHc

And now that I think about it, I think I might add this little feature to my Invader Overload cart. If you're using the auto-fire option, all you do is move left/right, so with this touch thing, you could play the game without ever having to press a key on the PocketCHIP keyboard.