Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (808)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (872)
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  Game Development / Newbie & Debugging Questions / Re: Polygons are not moving... on: 2017-08-22 19:45:20
Thank you both for the information! And especially thank you for the tutorial, because I looked into JavaFX and tried getting e(fx)clipse for eclipse neon and it was super confusing and I couldn't even find a download ANYWHERE for that plugin. Now with that tutorial I won't have to use that plugin  Grin
2  Game Development / Newbie & Debugging Questions / Re: Polygons are not moving... on: 2017-08-22 02:06:42
I think you have to add to each vertices' point data. In other words, each point in the x[] has to have the amount added to it for a horizontal movement.

Sometimes it makes sense to make a wrapper class that has the location that you can just give the X and Y movement amounts in a "normal" fashion, and have this class call the methods needed to handle updating the polygon point arrays.

(Reminding me why I'm glad I switched to JavaFX.)
(Been a while since I fussed with polygons--I hope I'm not totally off base.)

Would all the graphical stuff be easier to do things with, such as moving objects and collision interactions, if I switched my game over to JavaFX?

I've heard of JavaFX but never looked into it before.
3  Game Development / Newbie & Debugging Questions / Polygons are not moving... on: 2017-08-22 00:25:12
So, I have this little problem(and by little I mean game breaking). I'm using java.awt.Polygon to make a triangle and using java.awt.Graphics to draw it to the screen. So when I try to increase the velocity on either the x (x += velX) or y (y += velY) axis the triangle doesn't move! Angry  So I made the rendered shape a square without utilizing the Polygon class(I only used the Graphics class). When I tried moving the square the same way I moved the triangle, it worked.... Can anyone tell me how this is so? And point me in the right direction to make this work? Clueless

**DISCLAIMER** I don't want to use the Polygon.translate(deltaX, deltaY) method because it ignores collisions.
4  Games Center / WIP games, tools & toy projects / Re: First Recon - Multiplayer FPS on: 2017-06-30 00:26:26
Great concept! I just downloaded it. I can't wait until this game is completed!!

----------------------------------------------EDIT-------------------------------------
The menus look great. One thing that should be added is when you are in-game you should be able to press the esc key and a menu should pop up allowing the player to leave the game. I had to exit the game with the task manager hahaha
5  Game Development / Newbie & Debugging Questions / Re: Collision detection not working on: 2017-06-29 19:30:29
Thank you everyone for your contributions, I will take all your tips to heart.  Grin Grin Grin
6  Game Development / Newbie & Debugging Questions / Re: Collision detection not working on: 2017-06-29 19:11:35
Also, I don't think you need that method from the blob class.  you can just call intersects in the createLevel class. 

that's true, I just think it makes it more readable. Does it take up any resources by me doing that?

It would be slightly slower, and by slightly I mean you wont be able to tell the difference with 20 blobs, but with thousands of blobs you could tell.  Glad you fixed it Smiley

I plan on making a much bigger game than just 20 blobs on screen, haha. (it'll be a game simulating evolution) those blobs will just be obstacles for the creatures.

Do you have any tips for optimization?
7  Game Development / Newbie & Debugging Questions / Re: Collision detection not working on: 2017-06-29 19:02:48
Also, I don't think you need that method from the blob class.  you can just call intersects in the createLevel class. 

that's true, I just think it makes it more readable. Does it take up any resources by me doing that?
8  Game Development / Newbie & Debugging Questions / Re: Collision detection not working on: 2017-06-29 19:01:12
I'm locked out of my original account because I never received a activation email to the email I put down. Anyway, thank you all for your responses. So now I have a different problem, lol. Still regarding collision not working properly. I created a LinkedList to hold all the blobs as they are created, and I loop through it checking if the current blob collides with the ones in the LinkedList... and it collides every time so it's an infinite loop. Clueless  It just constantly deletes the blobs due to the collisions and I just don't know what I'm doing wrong.

Here is the new code I have

from Hanlder class:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
public void createLevel() {
      Random rand = new Random();
      LinkedList<GameObject> blobList = new LinkedList<GameObject>();
      for (int i = 0; i < 20; i++){
         Blob blob = new Blob(rand.nextInt(Game.WIDTH - 32), rand.nextInt(Game.HEIGHT - 32), ObjectId.Blob);
         addObject(blob);
         blobList.add(blob);
         if(blobList.size() > 1){
            for(int x = 0; x < blobList.size(); x++){
               if(blob.collidesWith(blobList.get(x).getBounds())){
                  removeObject(blob);
                  blobList.remove(blob);
                  i--;
                  System.out.println("INTERSECTION");
               }
               
            }
         }
         
         
      }
   }


from Blob class:
1  
2  
3  
4  
5  
6  
public boolean collidesWith(Rectangle rect){
      if(getBounds().intersects(rect.getBounds()))
         return true;
      else
         return false;
   }


I FIXED IT!!!! In the second for loop when there were 2 blobs in the linked list it checked if it collided with the first blob and itself. I made sure it didn't check if it collided with itself by making the for-loop loop until one before the end of the list.
9  Game Development / Newbie & Debugging Questions / Re: Collision detection not working on: 2017-06-29 17:56:22
I'm locked out of my original account because I never received a activation email to the email I put down. Anyway, thank you all for your responses. So now I have a different problem, lol. Still regarding collision not working properly. I created a LinkedList to hold all the blobs as they are created, and I loop through it checking if the current blob collides with the ones in the LinkedList... and it collides every time so it's an infinite loop. Clueless  It just constantly deletes the blobs due to the collisions and I just don't know what I'm doing wrong.

Here is the new code I have

from Hanlder class:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
public void createLevel() {
      Random rand = new Random();
      LinkedList<GameObject> blobList = new LinkedList<GameObject>();
      for (int i = 0; i < 20; i++){
         Blob blob = new Blob(rand.nextInt(Game.WIDTH - 32), rand.nextInt(Game.HEIGHT - 32), ObjectId.Blob);
         addObject(blob);
         blobList.add(blob);
         if(blobList.size() > 1){
            for(int x = 0; x < blobList.size(); x++){
               if(blob.collidesWith(blobList.get(x).getBounds())){
                  removeObject(blob);
                  blobList.remove(blob);
                  i--;
                  System.out.println("INTERSECTION");
               }
               
            }
         }
         
         
      }
   }


from Blob class:
1  
2  
3  
4  
5  
6  
public boolean collidesWith(Rectangle rect){
      if(getBounds().intersects(rect.getBounds()))
         return true;
      else
         return false;
   }
Pages: [1]
 
Riven (847 views)
2019-09-04 15:33:17

hadezbladez (5795 views)
2018-11-16 13:46:03

hadezbladez (2603 views)
2018-11-16 13:41:33

hadezbladez (6211 views)
2018-11-16 13:35:35

hadezbladez (1499 views)
2018-11-16 13:32:03

EgonOlsen (4734 views)
2018-06-10 19:43:48

EgonOlsen (5793 views)
2018-06-10 19:43:44

EgonOlsen (3276 views)
2018-06-10 19:43:20

DesertCoockie (4175 views)
2018-05-13 18:23:11

nelsongames (5501 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08
java-gaming.org 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‑gaming.org
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!