new_x = x * cos(n) - y * sin(n);
new_y = y * cos(n) + x * sin(n);
Taken from Andre Lamothe's "Tricks of the Game Programming Gurus", so don't bitch at me if you think it's wrong
new_x = x * cos(n) - y * sin(n);
new_y = y * cos(n) + x * sin(n);
Taken from Andre Lamothe's "Tricks of the Game Programming Gurus", so don't bitch at me if you think it's wrong
------------------
Lack
and BTW: lets say one sprite is 40*40 * 40directions * 16 frames * 2bytes =2.048 mb!?
(Check it out at http://www.image.dk/~noshit/scrshots.html if you like)
/NJ
I mean i am working on a isometric/action type game and you well be having 8-way movement.
As far as not being able to shoot any direction just move the ship ect over a pixel and your on a new angle for your shots.
Now, I've put together some of the things that you have all posted and now I have a simple polygon rotation demo. What nobody mentioned was that you have to draw your rectangle's vertices in each of the 4 quadrants:
| II | I | ----------- | III | IV |
Also, the formula(s) posted expect RADIANS instead of DEGREES. Other than that, my question has been pretty much answered. If you want to see the little demo I put together, download it here. Hopefully this weekend I will have some code to render a texture to the polygon.
Thanks to all that have posted.
Blake
[This message has been edited by Blake (edited September 24, 1999).]
It now includes direct surface manipulations for pixel and line drawing on DirectX surfaces (16bit surfaces). Even if you aren't interested in rotating polygons, you may want to look at the code just to see how direct surface manipulations are done. There is a good pixel plotting function and an interpretation of Bres's Line Drawing function.
Pasting a texture to the polygon at this point should be a walk in the park. I'll repost an example as soon as I sit down and work it out.
Blake