9

SP4CEBAR 2022-09-05 11:56 (Edited)

Ten plane sprites rotating individually, by copying data from ROM

This is a demo of my sprite rotator tool

Timo 2022-09-05 12:57

Which flight company is it? I want to avoid it! ;)

SP4CEBAR 2022-09-05 15:56 (Edited)

These aren't part of a company, these are stray planes

McPepic 2022-09-05 17:05

Ah, the wild plane in its natural habitat.

G-9 2022-09-06 17:05

^ underrated comment

AstonBrown 2022-11-06 10:57

how do you rotate sprites?

SP4CEBAR 2022-11-06 17:36 (Edited)

Well, it's quite technical, it uses a bit of math called "the 2D rotation matrix":

```
SUB ROTATE(X,Y,A,PX,PY)
XI=X-PX
YI=Y-PY
X= COS(A)*XI + SIN(A)*YI + PX
Y= -SIN(A)*XI + COS(A)*YI + PY
END SUB
```

this rotate function uses that to rotate the coordinates (X,Y) by the angle (A) in radians, around the pivot point (PX,PY) (I hope it works I've combined and simplified some subprograms to make it) The output of this function are the variables (X,Y) (in NX the variables that are put into the subprogram are also returned by the subprogram)

you could use this to rotate the coordinates of pixels, but as you can see, it does give some artifacts, the ideal way to use it is to use it on vector images

and it's also quite resource intensive, that's why I made this tool to pre generate the pixels and save it to ROM, so that it's more like swapping the image, instead of generating rotations, this makes it possible to use it real-time (NX is kinda slow)

Also, there are tricks to make rotations in a simpler way

Log in to reply.