this post was submitted on 12 Dec 2024
81 points (92.6% liked)
Fediverse
28716 readers
95 users here now
A community to talk about the Fediverse and all it's related services using ActivityPub (Mastodon, Lemmy, KBin, etc).
If you wanted to get help with moderating your own community then head over to [email protected]!
Rules
- Posts must be on topic.
- Be respectful of others.
- Cite the sources used for graphs and other statistics.
- Follow the general Lemmy.world rules.
Learn more at these websites: Join The Fediverse Wiki, Fediverse.info, Wikipedia Page, The Federation Info (Stats), FediDB (Stats), Sub Rehab (Reddit Migration), Search Lemmy
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
If you want some code for that I have my own C++ version I made for an ESP32 with OLED screen, it can easily be adapted to most other languages. I did it to get some programming practice. I have Tetris too. All you gotta do is replace the GPIO button inputs with keyboard inputs (or some other boolean on/off user input element) and replace the graphics framework and routines as well (it's only simple stuff like lines, boxes, and setting individual pixels). The whole thing runs in a "neverending" while loop, first checking inputs, then checking collisions, then redrawing any objects that need to move to another position.
I can upload to my GitHub and link them later after work. They do use OOP though, treating each sprite on the board as its own object, and feeding pointers to them into a collision detection routine every game tick. I dunno, some people have a visceral hate for OOP.