Quote: "Thanks, I still don't really understand it though
what does "~" mean?"
I use it to mean approximately. The final angle in the rotation calculation for each point should be that point's angular offset + the angle all of the points are being rotated to.
aluseus GOD might have a different method or be able to explain the 2d rotation better so I'll hold off on posting a code example for this.
But
Quote: "it'll mean I can make a 2D game where you can rotate the characters"
If you want to handle the rotation in real time like it's done in 3d, why not just use 3d? (I know it's the fun of figuring it out and conquring the task) But if you don't mind fixed rotations, you can just use rotated images that you capture from 3d. This example rotates a 3d cube with a couple of arms around the y axis. I captured images for a full 360 degrees. But for a sprite in a 2d game, it would probably suffice just to capture 8 images at 45 degree increments:
rem 3d capture to 2d sprite rotation illusion
rem by latch
rem 09/27/2007
sync on
sync rate 60
`autocam off
rem make a cube with a couple of arms
make object cube 1,25
make object cylinder 2,25
make mesh from object 1,2
for lmb=1 to 2
add limb 1,lmb,1
scale limb 1,lmb,30,200,30
color limb 1,lmb,rgb(rnd(255),rnd(255),rnd(255))
next lmb
rem cleanup
delete mesh 1
delete object 2
rem position the limbs
offset limb 1,1,13,0,0
rotate limb 1,1,0,0,90
offset limb 1,2,-13,0,0
rotate limb 1,2,0,0,270
rem black screen camera looking slightly down
color backdrop 0
position camera 0,50,-200
sync
rem capture images
for n=1 to 360
text 0,0,"Capturing image : "+str$(n)
yrotate object 1,wrapvalue(object angle y(1)+1)
get image n,230,205,400,300
sync
next n
rem switch to 2d
delete object 1
backdrop off
cls RGB(70,70,70)
sync
do
text 0,0,"Now the 2D sprite!"
for n=1 to 360
sprite 1,100,30,n
sync
next n
loop
The idea is you could save all of these images to files, or (depending on how many) you could make a sprite sheet or a tile of a single bitmap of all of the images and save that. Then you could recall the images and just cycle through them according to your character's controls. And you could of course, reuse the images over and over for whatever game you wanted. Also, if you wanted a larger and smaller version of the same character, scaling in 3d before capturing the image is usually clearer than scaling a sprite (can become blocky). So if you have any modeling skills or can get hold of some good 3d models, your 2d game could look very good.
Enjoy your day.