0 Members and 1 Guest are viewing this topic.
:ClrDraw:Draw sprite with size E*F at (0|0):For(A,0,E-1): For(B,0,F-1): If pxl-Test(A,B): sqrt(4*A*A+(4*B*B))->D .four times precision: arctan(A,B)->W: W+32->W .Let's rotate that 45 degrees or whatever you like: sin(W)*D//512->Y: cos(W)*D//512->X: Pxl-On(X+32,Y+32) .A little offset: End: End:End:DispGraph
I have a question concerning this particular routine. Would it work for 8x8 sprites? EDIT: Also how would go about it so that when I press a button the rotation occurs to a certain degree depending on how long u held it for?
Quote from: Ki1o on February 06, 2012, 05:41:53 pmI have a question concerning this particular routine. Would it work for 8x8 sprites? EDIT: Also how would go about it so that when I press a button the rotation occurs to a certain degree depending on how long u held it for?Yeah, offcourse. This routine works for any sprites, any size. If you store each black pixel's coordinate to the memory before the main loop, it'll be much faster.