![](/gfx/play80.png)
![](/bbs/thumbs/pico8_mot_asteriods-1.png)
This game is a little demo of a 2D transformation library I put together.
I chose a simple Asteroids clone because it is a good example of rotation and scaling.
The first tab contains the game. The second tab contains the library.
The library adds commands that affect 2D drawing commands, allowing you to rotate, scale and translate output, similar to the transformation commands in HTML Canvas or the old OpenGL 1.1 matrix stack.
It affects the following Pico-8 drawing commands:
- pset
- line
- rect/rectfill
- circ/circfill
- map
- spr
- sspr
Notes:
-
Be aware that spr, sspr and map are significantly slower as they all have to perform several tline calls internally.
- To make spr and sspr work, the cart creates a small map at 0x8000. If necessary this can be relocated to 0xa000, 0xc000 or 0xe000 by changing the "page" variable.
The transformation commands are:
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/media/58599/2_avi-llama-iso.png)
This looks great. Like having Processing available inside the Pico-8.
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](https://www.lexaloffle.com/bbs/files/15232/me-square.jpg)
You mentioned that SPR and SSPR are not affected. Can you draw rotated sprites with SPR and SSPR using your graphic library, @Mot ?
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/media/39676/35_buggy.png)
@dw817 nope - it's heavily based on tline.
You would have to sacrifice some map memory to layout the sprite and convert the spr/sspr call to a corresponding map call.
[Please log in to post a comment]