How To

Sprite Rotation?


griggle 2023-08-13 00:03

new to lrnx and was thinking of making something like an asteroids clone to get the hang of collisions, movement, sprite manipulation and things like that. looked through the manual and i can’t seem to find anything regarding sprite rotation (to be fair though i may have missed it). i looked for an asteroids clone in the posted programs and couldn’t find anything, searched “rotate” and “rotation” and couldn’t find anything either. i would be really appreciative of any pointers to something that could help, or an example program from someone familiar with the lrnx.

nathanielbabiak 2023-08-13 03:23 (Edited)

Hi welcome! Good news and bad news here.

Bad news is pixel based sprite rotation is super hard, and is not natively supported by the fantasy console (which is in-line with the purpose of this fantasy console, actually).

Good news is that, for the purpose of creating an asteroids-style game, you won't need it. What you should try instead is creating multiple versions of the sprite at various rotations, then your program would just pick the right one to display on-screen.

The system has plenty of resources for that approach, and it's an order of magnitude easier than attempting to create code-based support for pixel sprite rotation.

was8bit 2023-08-13 12:41 (Edited)

... space related stuff..

was8bit 2023-08-13 12:44

Feel free to experiment with my code to get a feel of things...

... also, if you remix any of my stuff into something interesting, you can post as it as a remix, just add your name to mine :)

was8bit 2023-08-13 12:48

You can flip images left/right and/or up/down with code...

Be aware that when you use flip settings for background cells, the flip settings remain on the background even if you change the image (the same is true for palette settings)

Settings set for sprites are also retained, so if you reuse a Sprite#, all of it previous settings will remain...

was8bit 2023-08-13 12:56

Space blast is the closest to what you want...

Please feel free to post any questions or troubles or such :)

SP4CEBAR 2023-08-14 09:07 (Edited)

Rotating pixels takes processing resources, however, here are two approaches to make real-time rotation possible:

Log in to reply.