Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (612)
Games in Android Showcase (172)
games submitted by our members
Games in WIP (658)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Java 2D / Re: Big Problem with the rotate transformation. on: 2008-06-28 08:48:32
 Grin yeeeeeeeeeeeeeeeeaaahh!!! it's a success!!  Roll Eyes  i have searched in a long time :s and it was very simple :s i didn't update the center of my bullet, so when java wanted to rotate my bullet by its center,  it rotate by a fixed point whereas my bullet was moving Smiley

thanks for you help!
2  Java Game APIs & Engines / Java 2D / Re: Big Problem with the rotate transformation. on: 2008-06-28 08:28:40
 Smiley thanks!

I know this technique, and I have tried it: but result is the same. It don't resolve the rotation of the bullet's orthogonal frame :s
But, if it's better at a programing point of view (i can say this in english?), I will re-write my code with it.

So, i believe that my problem come from of a no-update of the cent_X an cent_Y variables (i'm a scatter brain). Despite that this update won't resolve rotation of the orthogonal frame , in according with my calculation, the bullet's bouncing will work.

 I'm going to try and i come back.
3  Java Game APIs & Engines / Java 2D / Big Problem with the rotate transformation. on: 2008-06-27 09:49:58
 Smiley hello!
I'm french, so my english will not be perfect Smiley

I make a game with Java and its API Java2D. With this, I rotate my objects, a bullet _ which must take a direction so as to its head is toward the target_ . I use this way:

                        c.rotate(rt, cent_X, cent_Y); 
         c.drawRect(X_MIN, Y_MIN, X_MAX, Y_MAX); // it's a rectangle for checking
            //possition/placement de l'image:            
            //choix de la sous-image:
         c.rotate(-rt, cent_X, cent_Y);

The bullet is rotated in the well direction but, its orthogonal frame is changed too. Thus, when I check the bounce with the screenborders, there is error, "the screenborders of the bullet" have rotated.

In fact, the bullet bounces on the Rectangle(X_MIN,Y_MIN,X_MAX,Y_MAX) that i draw "for checking" during the Graphics2D rotation and not on the true BorderScreen.

I don't know if i was clear, but this problem is very strange.

If you want, I can give a .jar so as to you see my problem.

Edit: the "c" is a Graphics2D used by my Sprite.

re-Edit: it's all the more strange that my Object Tank don't pose problem when I rotate it by the same way. This tank move in four directions only (up, down, right, left), so its rotation's angle takes 0, 90, 180, 270 degres value. And these rotations don't pose problem _  visible problem would be more right_.
4  Java Game APIs & Engines / Java 2D / Re: Rotation driven/commanded thanks the cursor's position. on: 2007-08-26 19:26:14
 Huh hu!... oups, I didn't know that.

To end, I have try my technique with yours correction and it works!! It's very cool, because I thought I have made a mistake in my calculations!  Now, I know I don't have made mistake but I will use the "atan2" method.

So, I can close this topic !!

Merci!  Wink

5  Java Game APIs & Engines / Java 2D / Re: Rotation driven/commanded thanks the cursor's position. on: 2007-08-25 21:42:35
 Grin WAAAAAAAAAAAAWOUUUUUHHH!! Finally, I have tried the "atan2" method and it's fantastic, you don't know how I'm happy!!

Really, Thanks you oNyx! I don't have enough vocabullary in english so as to show my gratitude but in short: "Youpiiiii!!!!".

As for the ^ operator... I'm sorry, I don't understand  " a bitwise XOR function" :s and I would like understand because I would like undestand why my code must not work.

In any case, Thank you for this precision: I will try if my code works with a "adj*adj" and "opp*opp" instead of "adj^2" and "opp^2" even if the method of "atan2" is better than mine. I just want to see if my method could have functioned...

Re-good night!  Thank you Riven and oNyx.
6  Java Game APIs & Engines / Java 2D / Re: Rotation driven/commanded thanks the cursor's position. on: 2007-08-25 21:05:06
 Thanks  Smiley ! it's a very good method which help me. But... the center of the Default Locate ("repère" in french, I'm not sure that it's the good word, sorry) is in the upper-left corner of the screen. I will try to put my "adj" and "opp" in the "atan2" metod.

But is it possible to set the center of the Locate on my tank's position?

I'm going to try the "atan2" method tomorow, it may be the solution that I search...   Undecided I'm so tired, I don't really suceed in thinking this evening, hihi !

re-Thanks and good night!
7  Java Game APIs & Engines / Java 2D / Re: What's the best method for a Tiled-Image? on: 2007-08-25 10:26:39
 Cheesy hihi, merci infiniment CommanderKeith!
 In this forum, you seem more friendly than on some French Forum.

I endeavour speak Englisk as well as I could. But, if someone understands French, I can write the French traduction below my English sentences for your own training.

I will use the meth' drawImage() as you advised me, thanks! If you have the time, I have posted a other topic.

For each topic here, I woul like poste a traduction of your solution on this French Forum in order to help the French beginner:

I can?
8  Java Game APIs & Engines / Java 2D / Rotation driven/commanded thanks the cursor's position. on: 2007-08-25 09:19:17
 Smiley I don't know I'm allowed to post two topic in the same time... if I'm not, I'm very sorry :s !

I am a new problem, lol!

I try to make a game with tanks. It's a 2D game, and I use a upper view (I don't know if I use the good words, I'm sorry) I have done a target so as to aim at ennemy but the tank's cannon must be rotated toward the target.

I have used my Pythagore and "trigonometrie" knowledge in order to get the angle created by the horizontal axe and the axe formed by the position point of tank and position point of cursor, as is shown on the following page:

But, my rotated Objet disapears when the angle is close to 45° ... I don't understand why...  Huh

Here is the part of my code:

 int adj = cible_X-tank_X;
      int opp = cible_Y-tank_Y;
      double hyp = (adj^2+opp^2)^(1/2);
      double cosi_a = Math.abs(adj/hyp);
      double angl =  Math.acos(cosi_a);
      double pi = Math.PI;
      double angle = 0;
      if (adj<0 && opp<0){angle= angl + pi;}
      if (adj>0 && opp<0){angle= -angl;}
      if (adj<0 && opp>0){angle= -(angl + pi);}
      if (adj>=0 && opp>=0){angle= angl;}
         c.setColor(new Color(100,60,80));

 Cry please!! help me!

PS: oups, I would want to say "thanks to the cursor!": "grâce à la souris" in french.
9  Java Game APIs & Engines / Java 2D / Re: What's the best method for a Tiled-Image? on: 2007-08-25 08:48:23
 Cheesy WaWoouuuhh!! I was understood!!! lol Smiley I'm very happy: my english may be comprehensible!

Thank you BroumBroum. I don't know if I'm going to use Java Advanced Imaging... I'm a beginner in progra...

We can make Sprites easily with JAI's API?

re- thank you!  I'm very happy  Smiley !!
10  Java Game APIs & Engines / Java 2D / What's the best method for a Tiled-Image? on: 2007-08-24 18:51:40
 Smiley hi! I'm a french guy...  and I have need to be advised.

I know I'm not the best English Speaker of the World, so I beg to be excued for my  low level in english.

In fact, I have gone in a french forum where someone advised me to go here so as to find the solution of my problem.

My prob is the following:

I would make a java-game and I have to make Sprite, I succeeded in implementation of frame animation in my sprites: I use a big Image where I placed the different sub-image which will be used by the sprite so as to animates itself.

But I have found two, even three solution:

-the method: Graphics.drawImage(Image img, int dstx1, int dsty1, int dstx2, int dsty2, int srcx1*, int srcy1, int srcx2*, int srcy2, ImageObserver observer);

-the method: BufferedImage.getSubImage();

-and the method: CropImageFilter.

I would like know what's the most performant method.

I have realized some test, and it seems that BufferedImage add a time of loading (and lot of lines in the code, hihi!! :p ).
But I don't know if this detail is important...


Pages: [1]
afikri (9 views)
2015-08-31 09:30:22

afikri (17 views)
2015-08-31 09:30:07

afikri (7 views)
2015-08-31 09:27:24

afikri (11 views)
2015-08-31 09:26:40

Roquen (16 views)
2015-08-29 11:30:54

GamerC4 (28 views)
2015-08-22 20:38:50

GamerC4 (24 views)
2015-08-22 20:37:18

GamerC4 (29 views)
2015-08-22 20:37:01

Kefwar (34 views)
2015-08-22 18:07:24

GamerC4 (26 views)
2015-08-22 01:00:24
HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

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 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!