2D Oval Rotation

Blitz3D Forums/Blitz3D Beginners Area/2D Oval Rotation

Buggy(Posted 2007) [#1]
I am making a simple 2D game. I am trying to create all media in-game. The bullet is composed of two lines and an oval. I need to rotate the bullet 360 degrees (in increments of 10). I successfully was able to rotate the two lines, but not about a central point. My formula:

x# = lastX#*cos(10) - lastY#*sin(10)
y# = lastY#*cos(10) + lastX#*sin(10)

(I'm pretty sure that's the formula.)

As for rotating the oval, I'm stumped, because the oval is always drawn from the top-left-hand corner.

So my questions are:

1) How can I rotate the lines about a central point?
2) How can I rotate the oval about a central point?

I hope this makes sense.

Thanks in advance.


Terry B.(Posted 2007) [#2]
You could use a combination of handle image and rotateimage.


Buggy(Posted 2007) [#3]
The problem is, rotateImage usually lowers the quality of the image significantly, especially when I'm using things like Lines and unfilled Ovals, so that there will be gaps where a line is supposed to be. I could try it, I suppose.


b32(Posted 2007) [#4]
You could try the TFormFilter command to disable the smoothing of rotated images.
Also, in this topic, Stevie posted a program that rotates an oval: http://www.blitzbasic.com/Community/posts.php?topic=68057


Stevie G(Posted 2007) [#5]

Also, in this topic, Stevie posted a program that rotates an oval: www.blitzbasic.com/Community/posts.php?topic=68057



Yes, why not use that to create each frame of your animimage during pre-processing. Just join up all the points with lines and copyrect the result to your main animimage.

Stevie


Buggy(Posted 2007) [#6]
So... much... work... but thanks, it looks like this was what I'll be doing.

I had thought about this, but I thought that there might just be an easier way to figure out coordinates for the Oval command to be called from. I guess not, so thanks a lot.


Sir Gak(Posted 2007) [#7]
@Buggy:
"So... much... work... but thanks, it looks like this was what I'll be doing."

Oh, well, that's why we programmers get paid the big bucks (LOL!), cuz we do all the hard work, and the user just has to "use" what we create.