Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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] 2
1  Game Development / Newbie & Debugging Questions / Re: Tile based movement (Bomberman style) on: 2011-12-07 03:20:00
I think it works, cant test it yet though, cause I have some bug in my code, the units moves downwards by default, and never reaches their destination, but I have given you an appreciate Smiley
2  Game Development / Newbie & Debugging Questions / Re: Tile based movement (Bomberman style) on: 2011-12-07 02:44:34
yes I did that:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
        public void headTowardsDestination(){
      if(!this.destinationReached){
         int currentX = this.currentPosition.getX();
         int currentY = this.currentPosition.getY();
         int destinationX = this.destinationPosition.getX();
         int destinationY = this.destinationPosition.getY();
         if(currentX < destinationX){
            this.currentPixelX++;
         }else if(currentX > destinationX){
            this.currentPixelX--;
         }else if(currentY < destinationY){
            this.currentPixelY++;
         }else if(currentY > destinationY){
            this.currentPixelY--;
         }
      }
   }


But where should should I assign destinationReached = false; ?
3  Game Development / Newbie & Debugging Questions / Re: Tile based movement (Bomberman style) on: 2011-12-07 02:25:59
[EDIT] Well it kinda works!

My only problem is that it never stops moving now :S
Can't figure out where to put the check if the destination is reached....?
4  Game Development / Newbie & Debugging Questions / Re: Tile based movement (Bomberman style) on: 2011-12-07 00:01:58
This is my unit class, and the getters and setters for each field:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
public abstract class Unit implements WorldObject{
   private Position currentPosition;
   private Position destinationPosition;
   private String name;
   private String type;
   private int strength;
   private int agility;
   private int vitality;
   private int xp;
   private int level;
   private int chips;
   private double health;
   private double attackDamage;
   private double dodgeRating;
   private int luck;
   private int attackRange;
   private double maxHealth;
   private String unitClass;
   private Vector direction;
   private int energy;
   private BufferedImage image;
   private int currentPixelX;
   private int currentPixelY;
   private boolean visible;
   private boolean isMoving;

   public Unit(Position p, String name, String type) {
      this.currentPosition = p;
      this.setCurrentPixelX(0);
      this.setCurrentPixelY(0);
      this.name = name;
      this.type = type;
      this.direction = new Vector(1,0);
      loadImage();
   }

   private void loadImage() {
      this.image = null;
      try{
         this.image = ImageIO.read(new File("bin/image/unit/" + this.type + ".png"));
      }catch (Exception e) {
         System.out.println("Couldn't find " + this.type + "'s image file");
      }
   }
}
5  Game Development / Newbie & Debugging Questions / Re: Tile based movement (Bomberman style) on: 2011-12-06 05:52:11
So I'm back to square one, tried to draw units in a separate loop, but couldn't get it to work. Is there any other approach, or would you get me started at drawing them the correct way?

This is my "old" render method:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
   public void render() {
      Graphics2D bbg = (Graphics2D) this.backBuffer.getGraphics();
      BufferedImage image = null;

      this.player = this.game.getTileMap().getPlayer();
      this.inventory = player.getInventory();
      nullTile = new Tile(position, "WATER");
      this.unitHeightOffset = 0;
      for(int y = 0; y < 24; y++){
         for(int x = 0; x < 42; x++){
            int unitHeightOffset = 0;
            position.setX(x + player.getPosition().getX() - this.xOffset);
            position.setY(y + player.getPosition().getY() - this.yOffset);
            //Draw tiles
           Tile tile = this.game.getTileMap().getTileAt(position);
            if(tile != null){
               image = tile.getImage();
            }else{
               image = nullTile.getImage();
            }

            //Draw items
           Item item = this.game.getTileMap().getItemAt(position);
            if(item != null){
               image = item.getImage();
            }

            //Draw buildings
           Building building = this.game.getTileMap().getBuildingAt(position);
            if(building != null){
               image = building.getImage();
            }

            //Draw units
           Unit unit = this.game.getTileMap().getUnitAt(position);
            if(unit != null){
               image = unit.getImage();
               unitHeightOffset = -40; //Unit height
              unit.setVisible(true);
            }

            bbg.drawImage(image, x*tileDimension, y*tileDimension+unitHeightOffset, this);

         }
      }
     

      bbg.drawImage(inventory.getImage(), 400, 480, this);

      bbg.setColor(Color.WHITE);
      bbg.fillRect(0, 580, 40, 20);
      bbg.setColor(Color.BLACK);
      bbg.drawString(String.valueOf(gui.getFps()), 10, 595);

      bbg.dispose();
   }
6  Game Development / Newbie & Debugging Questions / Re: From Full Screen mode to windowed mode (and reverse) how? on: 2011-12-05 23:37:32
Will start off by saying, that I have not read it, but some of my friends have found it very usefull, I find this online version a bit incomplete though, but it might help Smiley

http://fivedots.coe.psu.ac.th/~ad/jg/ch03/index.html
7  Game Development / Newbie & Debugging Questions / Re: From Full Screen mode to windowed mode (and reverse) how? on: 2011-12-05 23:34:52
I think killers game guide explains it... I'll try to find the link Smiley
8  Game Development / Newbie & Debugging Questions / Re: Tile based movement (Bomberman style) on: 2011-12-05 09:55:37
This is now my render method:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
   public void render() {
      Graphics2D bbg = (Graphics2D) this.backBuffer.getGraphics();
      BufferedImage image = null;

      this.player = this.game.getTileMap().getPlayer();
      this.units = this.game.getTileMap().getUnits();
      this.inventory = player.getInventory();
      nullTile = new Tile(position, "WATER");
      for(int y = 0; y < 24; y++){
         for(int x = 0; x < 42; x++){
            position.setX(x + player.getPosition().getX()-xOffset);
            position.setY(y + player.getPosition().getY()-yOffset);
            //Draw tiles
           Tile tile = this.game.getTileMap().getTileAt(position);
            if(tile != null){
               image = tile.getImage();
            }else{
               image = nullTile.getImage();
            }

            //Draw items
           Item item = this.game.getTileMap().getItemAt(position);
            if(item != null){
               image = item.getImage();
            }

            //Draw buildings
           Building building = this.game.getTileMap().getBuildingAt(position);
            if(building != null){
               image = building.getImage();
            }

            //Old draw units
           /**
            Unit unit = this.game.getTileMap().getUnitAt(position);
            if(unit != null){
               image = unit.getImage();
               yOffset = -40; //Unit height
            }
            **/

            bbg.drawImage(image, x*tileDimension, y*tileDimension, this);

         }
      }
     
      for(Unit unit : units){
         image = unit.getImage();
          bbg.drawImage(image, unit.getPosition().getX() + unit.getCurrentPixelX() + (xOffset * tileDimension), unit.getPosition().getY() + unit.getCurrentPixelY() + (yOffset * tileDimension) - unitHeightOffset, this);
      }

      bbg.drawImage(inventory.getImage(), 400, 480, this);

      bbg.setColor(Color.WHITE);
      bbg.fillRect(0, 580, 40, 20);
      bbg.setColor(Color.BLACK);
      bbg.drawString(String.valueOf(gui.getFps()), 10, 595);

      bbg.dispose();
   }


My move method:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
   public boolean moveUnitToAnimated(Position from, Position to){
      Tween tween = new Tween();
      if(isAllowedUnitPosition(to)){
         Unit unit = this.tileMap.getUnitAt(from);
         this.tileMap.removeUnit(from);
         unit.setDirection(new Vector(to.getX()  + from.getX(), to.getY() + from.getY()));
         //Going left
        if(to.getX() < from.getX() && to.getY() == from.getY()){
            tween.tweenUnitLeft(unit);
         }
         //Going right
        else if(to.getX() > from.getX() && to.getY() == from.getY()){
            tween.tweenUnitLRight(unit);
         }
         //Going up
        else if(to.getX() == from.getX() && to.getY() < from.getY()){
            tween.tweenUnitUp(unit);
         }
         //Going down
        else if(to.getX() == from.getX() && to.getY() > from.getY()){
            tween.tweenUnitDown(unit);
         }
         this.tileMap.addUnitAt(to, unit);
         this.tileMap.getTileAt(from).setOccupied(false);
         this.tileMap.getTileAt(to).setOccupied(true);
         return true;
      }
      return false;
   }


And my tween class:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
public class Tween {

   public void tweenUnitLeft(Unit unit){
      for(int i = 20; i > 0; i--){
         unit.setCurrentPixelX(i);
      }
      unit.setPosition(new Position(unit.getPosition().getX() - 1, unit.getPosition().getY()));
      unit.setCurrentPixelX(0);
   }
   
   public void tweenUnitLRight(Unit unit){
      for(int i = 0; i < 0; i++){
         unit.setCurrentPixelX(i);
      }
      unit.setPosition(new Position(unit.getPosition().getX() + 1, unit.getPosition().getY()));
      unit.setCurrentPixelX(0);
   }
   
   public void tweenUnitUp(Unit unit){
      for(int i = 20; i > 0; i--){
         unit.setCurrentPixelY(i);
      }
      unit.setPosition(new Position(unit.getPosition().getX(), unit.getPosition().getY() - 1));
      unit.setCurrentPixelY(0);
   }
   
   public void tweenUnitDown(Unit unit){
      for(int i = 0; i < 20; i++){
         unit.setCurrentPixelX(i);
      }
      unit.setPosition(new Position(unit.getPosition().getX(), unit.getPosition().getY() + 1));
      unit.setCurrentPixelY(0);
   }
}




Is that anything what you meant? Tongue
9  Game Development / Newbie & Debugging Questions / Re: Tile based movement on: 2011-12-05 00:39:26
unit.setPosition(to) sets the unit on the next tile, no?  You need to just set the unit's position (say) 1 pixel towards the destination.

Yes it does, it is that which gives the teleporting effect, but I think my problem is, that I draw not in pixels, but tiles:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
   public void render() {
      Graphics2D bbg = (Graphics2D) this.backBuffer.getGraphics();
      BufferedImage image = null;

      this.player = this.game.getTileMap().getPlayer();
      this.inventory = player.getInventory();
      nullTile = new Tile(position, "WATER");
      for(int y = 0; y < 24; y++){
         for(int x = 0; x < 42; x++){
            int yOffset = 0;
            position.setX(x + player.getPosition().getX()-21);
            position.setY(y + player.getPosition().getY()-12);
            //Draw tiles
           Tile tile = this.game.getTileMap().getTileAt(position);
            if(tile != null){
               image = tile.getImage();
            }else{
               image = nullTile.getImage();
            }

            //Draw items
           Item item = this.game.getTileMap().getItemAt(position);
            if(item != null){
               image = item.getImage();
            }

            //Draw buildings
           Building building = this.game.getTileMap().getBuildingAt(position);
            if(building != null){
               image = building.getImage();
            }

            //Draw units
           Unit unit = this.game.getTileMap().getUnitAt(position);
            if(unit != null){
               image = unit.getImage();
               yOffset = -40; //Unit height
           }

            bbg.drawImage(image, x*20, y*20+yOffset, this);

         }
      }

      bbg.drawImage(inventory.getImage(), 400, 480, this);

      bbg.setColor(Color.WHITE);
      bbg.fillRect(0, 580, 40, 20);
      bbg.setColor(Color.BLACK);
      bbg.drawString(String.valueOf(gui.getFps()), 10, 595);

      bbg.dispose();
   }


Or am I totally wrong? Tongue

I really want a bomberman like movement. If you press a movement key, then it animates a movement between tiles...
10  Game Development / Newbie & Debugging Questions / Re: Tile based movement on: 2011-12-05 00:17:06
This is my move method so far, it's kind of teleporting from one tile to another... I can't figure out to do those tweens, as my draw method draws in tiles, and not pixels. How do I get started? Smiley


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public boolean moveUnitTo(Position from, Position to) {
      if(isAllowedUnitPosition(to)){
         Unit unit = this.tileMap.getUnitAt(from);
         this.tileMap.removeUnit(from);
         unit.setDirection(new Vector(to.getX()  + from.getX(), to.getY() + from.getY()));
         unit.setPosition(to);
         this.tileMap.addUnitAt(to, unit);
         this.tileMap.getTileAt(from).setOccupied(false);
         this.tileMap.getTileAt(to).setOccupied(true);
         return true;
      }
      return false;
   }
11  Game Development / Newbie & Debugging Questions / Re: Tile based movement on: 2011-12-04 18:32:12
I really want to implement all of the game myself, not using pre-coded stuff, but thanks for the link, will look into it... Smiley

But I think this is a really hard part to do, I might be back for more help Smiley
12  Game Development / Newbie & Debugging Questions / Re: Tile based movement on: 2011-12-01 13:25:08
Thanks so far, I will look into your suggestions Smiley
13  Game Development / Newbie & Debugging Questions / Re: Tile based movement on: 2011-12-01 09:31:03
That part I have done, I can move from tile to tile, but I can't make it smooth movement Smiley Sorry for not being clear about that Smiley
14  Game Development / Newbie & Debugging Questions / [SOLVED minor bugs] Tile based movement (Bomberman style) on: 2011-12-01 03:11:11
So I have this tile based game, with each tile being 20x20 pixels, and I draw them on a canvas in a loop like this:

1  
2  
3  
4  
5  
6  
7  
for(int y = 0; y < 24; y++){
         for(int x = 0; x < 42; x++){
            int yOffset = 0;
            position.setX(x + player.getPosition().getX()-21);
            position.setY(y + player.getPosition().getY()-12);
                                //drawing stuff from positions
}


I now wonder how to make my player move smoothly from tile to tile when I press a button on my keyboard
Any ideas how to start? To get me going? Smiley
15  Game Development / Newbie & Debugging Questions / Re: Having trouble with drawing the right way (Top-Down Tile Game) on: 2011-11-30 19:47:45
Of cause, now I see the problem... The problem was that I created a new tile if the tile was null, and in the constructor I loaded the image Tongue
16  Game Development / Newbie & Debugging Questions / Re: Having trouble with drawing the right way (Top-Down Tile Game) on: 2011-11-30 19:44:47
You're having a point there... Even though I fixed that.... But it works after I just created a null tile, and just using that tiles image Smiley

It down to 1-6 time in milliseconds now! Cheesy

I'm so happy, have been working on those two problems I've posted to day for like a month!!!!

Gave an appreciate to everyone who helped Smiley
17  Game Development / Newbie & Debugging Questions / Re: Having trouble with drawing the right way (Top-Down Tile Game) on: 2011-11-30 19:35:54
This is how you create a compatible image (lines 101-113).

As others have pointed out:
- Try to do as little drawing calls as possible, Java2D is quite slow.
- Don't load images in your loop
- Try to create as little number of objects in your loop
- Find better ways than using lots of for loops

Thanks again a lot Smiley I just found out, that if I don't have any null tiles on my screen it only takes 1-7 milliseconds to draw, so it must be something with the null tiles I draw... Just have to figure out how to solve that problem Smiley

Would need to make my player go off center when he reaches the edge of the world.....

But I will look into the link you posted Smiley

And thanks to delt0r and Lordpomeroy too Smiley
18  Game Development / Newbie & Debugging Questions / Re: Having trouble with drawing the right way (Top-Down Tile Game) on: 2011-11-30 17:53:23
Just to make things anymore cryptic (for me especially), when I move around, the time it takes to do the loop is going towards 16 (as I want).... Still having 200+ in the start though o.O

I really can't figure this out myself, my knowledge on this area isn't enough Smiley
19  Game Development / Newbie & Debugging Questions / Re: Having trouble with drawing the right way (Top-Down Tile Game) on: 2011-11-30 17:41:27
Ohh I feel stupid, will look into that Tongue Thanks Smiley
20  Game Development / Newbie & Debugging Questions / Re: Having trouble with drawing the right way (Top-Down Tile Game) on: 2011-11-30 16:37:15
I can't find the method, that you are referring to Smiley

And I meant loading ONLY the images that I draw into memory Smiley
21  Game Development / Newbie & Debugging Questions / Re: Having trouble with drawing the right way (Top-Down Tile Game) on: 2011-11-30 16:17:21
There you find the problem: You are loading your image everytime.

Now I load the image in the constructor, and it got better, down at 200+ milliseconds, but not quite the time i hoped for... Was aiming for 16 milliseconds (to reach 60 fps)... would it help to only load into memory the images that I draw?

If so, how would I do such a thing?
22  Game Development / Newbie & Debugging Questions / Re: Having trouble with drawing the right way (Top-Down Tile Game) on: 2011-11-30 15:56:27
Quote
1  
bbg.fillRect(0, 580, 800, 20);
Don't fill 800*20 * 24*42 = 16 128 000 pixels per update?

Where do you get that calculation from? Tongue
23  Game Development / Newbie & Debugging Questions / Re: Having trouble with drawing the right way (Top-Down Tile Game) on: 2011-11-30 15:51:18
I already use ImageIO, but it's in the tile class, and I use .png


This is the code I use in Tile.class:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
   public BufferedImage getImage() {
      BufferedImage image = null;
      try{
         image = ImageIO.read(new File("bin/image/tile/" + this.type + ".png"));
      }catch (Exception e) {
         System.out.println("Couldn't find " + this.type + "'s image file!");
      }
      if(this.isTargeted){
         Graphics2D g2d = image.createGraphics();

         // Draw on the image
        g2d.setColor(Color.red);
         g2d.fill(new Ellipse2D.Float(0, 0, 20, 20));
         g2d.dispose();
      }
      return image;
   }
24  Game Development / Newbie & Debugging Questions / Re: Having trouble with drawing the right way (Top-Down Tile Game) on: 2011-11-30 14:32:55
Can you specify, I don't quite understand what you mean Smiley

Also found out that I should use a canvas and not a JPanel to draw on, but it didn't help though.... Sad
25  Game Development / Newbie & Debugging Questions / [Solved]Having trouble with drawing the right way (Top-Down Tile Game) on: 2011-11-30 14:17:53
I'm having trouble drawing the right way it seems, it takes about 500-800 milliseconds to complete a single loop in my render method. Any suggestions or links that might explain what to do. Can't find anything on the forum, please help! Smiley


This is my render code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
public class GamePanel extends Canvas{

   private BufferedImage backBuffer;
   private int windowHeight;
   private int windowWidth;
   private ZompocalypseGame game;
   private GUI gui;
   private Position position;

   public GamePanel(int windowWidth, int windowHeight, ZompocalypseGame sGame, GUI gui){
      setIgnoreRepaint(true);
      this.windowWidth = windowWidth;
      this.windowHeight = windowHeight;
      setVisible(true);
      this.game = sGame;
      this.gui = gui;
      this.position = new Position(0,0);
     
      this.backBuffer = new BufferedImage(this.windowWidth, this.windowHeight, BufferedImage.TYPE_INT_RGB);
   }

   public void draw(){
      Graphics2D g = (Graphics2D) getGraphics();
     
      g.setColor(Color.BLACK);
      g.fillRect(0, 0, windowWidth, windowHeight);
     
      g.drawImage(this.backBuffer, 0, 0, this);
      g.dispose();
   }

   public void render() {
      Graphics2D bbg = (Graphics2D) this.backBuffer.getGraphics();
      BufferedImage image = null;
     
      Player player = this.game.getTileMap().getPlayer();

      long foo = System.currentTimeMillis();
     
      for(int y = 0; y < 24; y++){
         for(int x = 0; x < 42; x++){
            position.setX(x + player.getPosition().getX()-21);
            position.setY(y + player.getPosition().getY()-12);
            int yOffset = 0;
            //Draw tiles
           Tile tile = this.game.getTileMap().getTileAt(position);
            if(tile != null){
               image = tile.getImage();
            }else{
               tile = new Tile(position, "WATER");
               image = tile.getImage();
            }

            //Draw items
           Item item = this.game.getTileMap().getItemAt(position);
            if(item != null){
               image = item.getImage();
            }

            //Draw buildings
           Building building = this.game.getTileMap().getBuildingAt(position);
            if(building != null){
               image = building.getImage();
            }

            //Draw units
           Unit unit = this.game.getTileMap().getUnitAt(position);
            if(unit != null){
               image = unit.getImage();
               yOffset = -40; //Unit height
           }
           
            bbg.drawImage(image, x*20, y*20+yOffset, this);
           
            bbg.setColor(Color.WHITE);
            bbg.fillRect(0, 580, 800, 20);
           
            bbg.setColor(Color.BLACK);
            bbg.drawString(String.valueOf(gui.getFps()), 10, 595);
         }
      }
      long bar = System.currentTimeMillis();
      System.out.println(bar - foo);
   }
}
26  Game Development / Newbie & Debugging Questions / Re: So I think I have a problem with my fps on: 2011-11-30 13:52:54
So did some testing on my game, and found out my loop takes 500+ milliseconds, that could be the problem for the lag... Tongue
27  Game Development / Newbie & Debugging Questions / Re: So I think I have a problem with my fps on: 2011-11-30 13:43:08
So I tried your loop, hopefully I understood it right. It looks like this now:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
public void run() {
      double startTime, endTime, deltaTime, time;
      double timeCounter = 0;
      int framesDrawn = 0;

      while (running) {
         startTime = System.currentTimeMillis();

         update();
         render();
         draw();

         endTime = System.currentTimeMillis();

         deltaTime = endTime - startTime;
         time = fps - deltaTime;

         timeCounter += deltaTime;
         if(timeCounter > 1000){
            currentFps = framesDrawn / 1000;
            timeCounter = 0;
            framesDrawn = 0;
         }else{
            framesDrawn++;
         }

         long sleepTime = (long) (1000 / 60);

         try {
            Thread.sleep(sleepTime);
         } catch (Exception e) {
            System.out.println(e);
         }

      }
      setVisible(false);
   }


but it says I have 1.7E-6 fps o.O
28  Game Development / Newbie & Debugging Questions / Re: So I think I have a problem with my fps on: 2011-11-30 13:15:29
ra4king I'm using the method you said to me, about using the update method to check for inputs, and it like if the program doesn't react on every input, but only some times... Don't know if it's there the problem is?


tried your solution, but no luck
29  Game Development / Newbie & Debugging Questions / Re: So I think I have a problem with my fps on: 2011-11-30 13:09:10
Well it dosen't help, baybe I should try post a link with the game, so you/others can see what I mean... Smiley

http://sudopwn.net/Files/Zompocalypse.zip
30  Game Development / Newbie & Debugging Questions / Re: So I think I have a problem with my fps on: 2011-11-30 13:04:34
i meant 0.001 Tongue forgot two 0s there Tongue

I tried to make it work, but maybe I should give it another try... I'll be back with a post in a few mins
Pages: [1] 2
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

ctomni231 (37 views)
2014-07-18 06:55:21

Zero Volt (35 views)
2014-07-17 23:47:54

danieldean (28 views)
2014-07-17 23:41:23

MustardPeter (31 views)
2014-07-16 23:30:00

Cero (46 views)
2014-07-16 00:42:17

Riven (47 views)
2014-07-14 18:02:53

OpenGLShaders (36 views)
2014-07-14 16:23:47

Riven (36 views)
2014-07-14 11:51:35

quew8 (32 views)
2014-07-13 13:57:52

SHC (68 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!