Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (603)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (650)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Java 2D rotation problem?  (Read 4344 times)
0 Members and 1 Guest are viewing this topic.
Offline Captain-Goatse

Junior Devvie

I suck at teh 2D. XBOX IS BIG LOL!111

« Posted 2002-10-21 11:48:14 »

How does the rotate funtionc in java really work? It seems to me that if you are rotating images, after you have rotated about 180 degrees the image flips so basically my image can never be backwards. I'm rotating my image according to the mouse and in this case using ready made graphics doesn't work very well space wise, besides its not going to be seamless compared to the mouse.

Now the problem remains. I need to rotate my graphics object, but is it going to be fast enough if I rotate the images pixel by pixel with the trigonometric transformations using the image object?

I'm already having flickering problems(don't know its speed specific problem) with even clearRect and clipping.
Offline Captain-Goatse

Junior Devvie

I suck at teh 2D. XBOX IS BIG LOL!111

« Reply #1 - Posted 2002-10-25 11:42:58 »

Since the the 2d rotate is a horrible cheater I'm implementing the pixel grabber thing for the images that turn around.

I need to know these things before I conclude anything.
How fast is the pixel grabber function? Lets say that I make make an array which stores 360/5=72 images which all are for the different positions of the mouse, now I take this array and recall the right image every time the mouse comes to its area. This doesn't sound good to me, it is kind of complicated, but sure, if it is fast I'll go for it.

The other method is that the program dynamically creates images every time the mouse moves to right position. This way the image is created each time the mouse is moved. This sounds good, but lets say if I have 35 other sprites, perhaps even more, which are animated and are using the exatly same strategy, wouldn't it get slow? I think yes.

Does anyone have any experiences on this that you could possibly share? Does anyone know what is the pixel rotation math? Currently I have tried to do all kinds of fomulas, but the one I succeeded can be used only for 90 degree rotation since it blurs or craps up everything else.
Offline Captain-Goatse

Junior Devvie

I suck at teh 2D. XBOX IS BIG LOL!111

« Reply #2 - Posted 2002-10-25 12:57:33 »

I figured the rotation alright, I will post the code later. Thanks anyway. Still I needs to know how fast the pixel grabbing is compared to affine transform?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Captain-Goatse

Junior Devvie

I suck at teh 2D. XBOX IS BIG LOL!111

« Reply #3 - Posted 2002-10-25 15:23:51 »

OK the math is fine, but I still have same sort of problem as with graphics2D rotate. I'm using this to get the cords of my mouse

The problem doesn't seem to be with the rotation functions, because when I tried andle = x++ in thread rotations everything worked out fine. When I use the code from above it seems to be it can't draw certain areas.

I'm going to bed, perhaps tomorrow, will be better for this.
Offline Captain-Goatse

Junior Devvie

I suck at teh 2D. XBOX IS BIG LOL!111

« Reply #4 - Posted 2002-10-26 04:54:51 »

My bad... There is absolutely nothing wrong with the java rotation. It doesn't cheat.

As my mind has been clarified with some natural sleep I immediatly found the problem. The problem how I calculate the cords of the mouse as I concluded last night.

Lets take example where mouse is at negative x and negative y side of the cordinates(I'm using polar)
atan((376 -400)/(276-400))

Now the negatives are going to take out each other and hence the angle which should be negative is now positive.

I'm sorry to flood this board with my stuff.. I'm going to take my design doc elsewhere. Thanks anyway.

Offline Captain-Goatse

Junior Devvie

I suck at teh 2D. XBOX IS BIG LOL!111

« Reply #5 - Posted 2002-10-27 07:04:35 »

::)Mission Accomplished - Problem solved  Roll Eyes

I had to use atan2 instead of atan1, too bad I had figured out formulas for it before I realized that i was supposed to do so. Posting code to frequently asked pretty soon. The image rotation and the mouse angle.

Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Jesse (16 views)
2015-07-29 04:35:27

Riven (37 views)
2015-07-27 16:38:00

Riven (19 views)
2015-07-27 15:35:20

Riven (22 views)
2015-07-27 12:26:13

Riven (12 views)
2015-07-27 12:23:39

BurntPizza (32 views)
2015-07-25 00:14:37

BurntPizza (42 views)
2015-07-24 22:06:39

BurntPizza (24 views)
2015-07-24 06:06:53

NoxInc (31 views)
2015-07-22 22:16:53

NoxInc (21 views)
2015-07-22 22:13:39
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!