Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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 / Shared Code / Re: RPG Engine [Updated 4/16/2014] on: 2014-04-26 00:23:31
@Orogamo, Thank you for your advice as well as suggestion.  I will be adding a minimap feature that can be disabled as well as enabled via the server.  This way the server Administator can choose if he/she would like the minimap feature in use.
2  Game Development / Game Play & Game Design / Re: Start, Pause and Game Over screens on: 2014-04-23 22:05:36
Currently in my rpg engine I have a base that uses a gamestate manager and will update and draw whatever state is currently selected.  Feel free to check it out and use it.
My project

3  Game Development / Shared Code / Re: RPG Engine [Updated 4/16/2014] on: 2014-04-23 21:23:07
Well... if you abstracted all the hard stuff away, then wouldn't it still be easy to use for the end user? Sounds like you don't want to take the time to implement it because its hard, no offense! But trust me, random terrain generation would be very useful in an engine. I think not implementing because its hard is silly...

It's not that it would be hard to implement, because to be honest it wouldnt.  I simply do not see much of use for it in an rpg engine where the user can  directly build the map.

Would you guys like for this to be Implemented?  As I stated I am only doing this to improve upon myself and grow my knowledge in java.  This being said if more people than not would like this feature then I will be happy to add a terrain generator based off this one.

Also Gibbo3771, I love your signature, from now on when I don't get the results I want from code I am going to say this to myself.
4  Game Development / Shared Code / Re: RPG Engine [Updated 4/16/2014] on: 2014-04-23 16:50:00
Have you though about using Procedural Terrain Generation?
If so you can take a look at my code.
It also has other "cool" features implemented Smiley

edit:
Link to the "Game"

I would be happy to take a look at it, however I am not sure if I will be using this, as the idea for this engine is for quick and easy game design and development.
5  Game Development / Shared Code / Re: RPG Engine [Updated 4/16/2014] on: 2014-04-23 06:22:34
I think a crash in the game loop is a pretty serious problem.

Whatever 'multilayer' (multiplayer?) system you're working on is nowhere near as important.

Multiplayer, yes it was a typo.   It does not crash the gameloop... The loop continues to run as scheduled however the first loop is negative after the first loop it continues with no abnormalities.  The error has been fixed now, so it is irrelevant now.

I am still looking for suggestions from you guys!  So please speak up, what would you like to see in this?
6  Game Development / Shared Code / Re: RPG Engine [Updated 4/16/2014] on: 2014-04-21 01:34:09
Found a bug when i try to run it
1  
2  
3  
4  
java.lang.IllegalArgumentException: timeout value is negative
   at java.lang.Thread.sleep(Native Method)
   at com.ChimpyGames.GamePanel.run(GamePanel.java:64)
   at java.lang.Thread.run(Unknown Source)

Doesn't seem to be a problem thought it's only started as negative

Thank you for your report.  I am aware of this bug, and it will be fixed soon.  However, it is not high on the fix list at this moment.  I am currently working on a multilayer feature this is currently top priority.
7  Game Development / Newbie & Debugging Questions / Re: Draw problem upon compile on: 2014-04-16 18:55:34
I see in your code you're using FileReaders. That won't work on files that are packaged inside a jar file.
Solution to that is to either:
  • Not have the files packed in the jar, but instead alongside the jar.
  • Use Class.getResourceAsStream()

Look up those if you don't know what I'm talking about.

It works!  YAY  xD thank you very much sir.  I will look up Class.getResourceAsStream() because I do want the map files packed into my jar.
@opiop65.  Thank you for attempting to help as well.  All of the help is much appreciated!
8  Game Development / Newbie & Debugging Questions / Re: Draw problem upon compile on: 2014-04-16 18:50:00
Well if loads the ground.draw, perfectly fine during bother I used
      g.setColor(Color.YELLOW);
      g.drawString("Map loaded", 50,50);

and Map loaded shows when It is ran as an independent and when I run it through eclipse.  So it is having trouble loading the grounds mapfile.
9  Game Development / Newbie & Debugging Questions / Re: Draw problem upon compile on: 2014-04-16 18:44:30
Throw in some print lines when you load the maps in. Run it from the command line and see if everything works out ok.

It works perfectly fin when I run it straight from eclipse, it just does this when It is ran as an independent jar file.
10  Game Development / Newbie & Debugging Questions / Re: Draw problem upon compile on: 2014-04-16 18:31:09
I have, and it did the same thing.  I see, well something is going on here  xD  I just can not figure out what.

It does draw the player though, It is almost like it is just not reading the map files.
11  Game Development / Newbie & Debugging Questions / Draw problem upon compile[SOLVED] on: 2014-04-16 18:19:15
Ok, so I am having trouble with my Play menu, when I run my program under eclipse the layers get drawn in, however when I run it under its own executable they do not.  Can someone take a look at my code.

Here is my source zipped up source

Also if you do not want to download anything I would be happy to let you connect directly to my project and take a look at it.

The problem was solved!  It was a problem of calling an outside resource and not an inside
12  Game Development / Shared Code / Re: My GameStateManager on: 2014-04-16 01:29:48
That is a great Idea, I will be adding that later tonight.  Thank you for your insight @Coldstream24.  This will help cut down on if statements by a lot!

I am still looking for ideas folks!  Hit me up with some good ones!
13  Game Development / Newbie & Debugging Questions / Re: Mouse Coords in a tiled world. on: 2014-04-16 00:02:09
IF you are scaling your tiles you will need to dived the x or y position by the scale amount.

Example if I am scaling by 32 I would take x/32  or y/32
14  Game Development / Shared Code / Topic needs deleted. on: 2014-04-15 23:51:46
This post has been removed!

No longer willl I be creating an RPG engine, I have taken a new direct and decided to continue the development as a game.
15  Discussions / Business and Project Management Discussions / Re: Looking for a small team!! on: 2014-03-31 02:08:52
I suppose when you put it like that you are right, I understand this will be a hard project to do with a team.  I mostly wanted the team experience, I ran through a few of the other threads as well, you are absolutely right, I think I should hammer out all the details and just ask for opinions from other players.   Do not worry, I am not the type to get offended as long as it is criticism that will actually assist me.  IF you would of just said, that's stupid or you're retarded, I would of been offended.  But with criticism I can learn what experienced programmers think of my project ideas, etc..  Now that I have simply blabbed I will take your advice.  I am not giving up, and it may take longer but if I can do at least most of this by myself then I will improve quite a bit.

My biggest problem is that I am the only person around my area (That I am aware of), that can program in java.  Most people around here do not even know what www stands for lol. 
16  Discussions / Business and Project Management Discussions / Re: Looking for a small team!! on: 2014-03-31 01:45:52
1) No, I have done a few simple games, I am basically doing this to improve my abilities then I will probably give this source out for others to use.

2) I am aware of that, I am still looking into other and better ways to make this work, this is why I am not removing NPCs.  I am open to any suggestions if you have some.

3) If/When I get people I want to get their opinions, on what they believe the game should contain and decide together what all the game is capable of.  So I guess you could say, No, I do not plan on immediate programming. However I do plan on starting the discussions as soon as possible.

Please, for your own good, back away from group work. It is way more difficult and stressful than single-work. Even with experienced people, it is often a challenge. Communication is just horrible with these types of projects.
  Thank you for your input I will defiantly keep this in mind for future projects, but I do feel that working with a team would be nice, this way I can we can all hopefully help each other improve.
17  Discussions / Business and Project Management Discussions / Looking for a small team!! on: 2014-03-31 01:35:19
Ok, so the big part of this before you say you want to be on the team.  I am still fairly new to this and learning everyday.  This being said, I am not asking someone else to create this game for me, I am looking for a team to create it with me.

This game is currently in the planning stages, however this is what I have so far.
  • This will be an online game, I am still considering single player capability.
  • The player will start out with a small farm, the player will be able to design their own farm, based off of a limited amount of tiles.  and Place things around the map.
  • Players will be able to make money using their farm, opening shops, hunting, fishing, even mining, and creating needed objects for other players, even quests
  • and more to come

My main idea is to build an actual society of players, by the players for the players.  With little contact with non player characters.  Although NPCs will still exist for the players who prefer to do things on their own.

If you have experience with sockets this would be preferred, sockets are something I am currently working on understanding, so with this knowledge it would defiantly help the development.  

If interested, you can message me, or just post on here.  You do not have to be an expert in java, as long as you understand the basics then you are welcome to apply for the team.
18  Games Center / Showcase / Re: CUBI [Pre-Alpha] on: 2014-03-30 19:39:10
You should give credit where credit is due, most of the code, and images came from ForeignGuyMike.  I am sure he would like credit for what he has done.
19  Game Development / Networking & Multiplayer / Re: I would like your opinion on sending commands on: 2014-03-30 18:18:22
Alright, I will take a look at it, thank you.
20  Game Development / Networking & Multiplayer / I would like your opinion on sending commands on: 2014-03-30 17:34:31
As the title states I want your opinion.   I am making a mutliplayer game to get better with java, and I am improving but I need your assistance.  What do you think the best way to send a command from client to server?  I was thinking output.write    and placing a switch case on the server end.   However with adding a chat feature this will end up causing problems.  This being said, what do you guys think is the best way to proceed?
21  Game Development / Newbie & Debugging Questions / Re: Having trouble with the special drawing. on: 2014-03-19 17:08:38
Well I  have read a few java tutorials but as I stated I am still fairly new, but thank you for your assistance.

As for next time alright I can use paste bin.

[size=20pt]Edit[/size]
You will be happy to know I have downloaded all of the videos from thenewboston website on java development this way I am not in need of any more assistance that is, how shall I say...Ignorant.
22  Game Development / Newbie & Debugging Questions / Having trouble with the special drawing. on: 2014-03-19 15:36:41
Ok, so I am still fairly new to java and am working on this game to improve myself.  When my special is set to true it does not draw for some reason can someone tell me what I am doing wrong?

Below are the files containing code having to deal with the special.

Special.java
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  
package com.chimpygames;

import java.awt.Color;
import java.awt.Graphics2D;

public class Special {

   // fields
   private double x;
   private double y;
   private int r;
   private int increase;

   private Color color1;

   
   //constructor
   public Special(int x, int y) {
      //new code
      this.x = x;
      this.y = y;
      r = 0;
      increase = 1;

      color1 = Color.WHITE;
   }

   // functions
   
   public double getx() { return x; }
   public double gety() { return y; }
   public double getr() { return r; }

   public boolean update() {
      //new true code
         while (r <= 10) {
         r += increase;
         r++;
         return false;
      }
     
      return false;
   }

   public void draw(Graphics2D g) {
      g.setColor(color1);
      g.drawOval((int) x,(int) y, 5 * r, 5 * r);
   }
}


GamePanel.java
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  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
package com.chimpygames;

import javax.swing.JPanel;

import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.image.*;
import java.util.ArrayList;

import javax.swing.JPanel;

public class GamePanel extends JPanel implements Runnable, KeyListener {

   // Fields
   public static int WIDTH = 400;
   public static int HEIGHT = 500;

   private Thread thread;
   private boolean isRunning;

   private BufferedImage image;
   private Graphics2D g;

   private int FPS = 30;
   private double averageFPS;

   public Player player;
   public static ArrayList<Bullet> bullets;
   public static ArrayList<Enemy> enemies;
   public static ArrayList<Special> special;

   // Constructor
   public GamePanel() {
      super();
      setPreferredSize(new Dimension(WIDTH, HEIGHT));
      setFocusable(true);
      requestFocus();
   }

   // Functions
   public void addNotify() {
      super.addNotify();
      if (thread == null) {
         thread = new Thread(this);
         thread.start();
      }
      addKeyListener(this);
   }

   @Override
   public void run() {
      isRunning = true;

      image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
      g = (Graphics2D) image.getGraphics();

      player = new Player();
      bullets = new ArrayList<Bullet>();
      enemies = new ArrayList<Enemy>();
      for (int i = 0; i < 2000; i++) {
         enemies.add(new Enemy(1,1));
      }
     
      long startTime;
      long URDTimeMillis;
      long waitTime;
      long totalTime = 0;

      int frameCount = 0;
      int maxFrameCount = 30;

      long targetTime = 1000 / FPS;

      // GAME LOOP
      while (isRunning) {

         startTime = System.nanoTime();

         gameUpdate();
         gameRender();
         gameDraw();

         URDTimeMillis = (System.nanoTime() - startTime) / 1000000;
         waitTime = targetTime - URDTimeMillis;

         try {
            Thread.sleep(waitTime);
         } catch (Exception e) {
         }

         totalTime += System.nanoTime() - startTime;
         frameCount++;
         if (frameCount == maxFrameCount) {
            averageFPS = 1000.0 / ((totalTime / frameCount) / 1000000);
            frameCount = 0;
            totalTime = 0;
         }

      }
   }

   private void gameUpdate() {

      //player update
      player.update();
     
      //bullet update
      for (int i = 0; i < bullets.size(); i++) {
         boolean remove = bullets.get(i).update();
         if (remove) {
            bullets.remove(i);
            i--;
         }
      }
     
      //enemy update
      for (int i = 0; i < enemies.size(); i++) {
         enemies.get(i).update();
      }
     
      //bullet and enemy collisions
      for (int i = 0; i < bullets.size(); i++) {
         
         Bullet b = bullets.get(i);
         double bx = b.getx();
         double by = b.gety();
         double br = b.getr();
         
         for (int j = 0; j < enemies.size(); j++) {
         
            Enemy e = enemies.get(j);
            double ex = e.getx();
            double ey = e.gety();
            double er = e.getr();
           
            double dx = bx - ex;
            double dy = by - ey;
            double dist = Math.sqrt(dx * dx + dy * dy);
           
            if (dist < br + er) {
               e.hit();
               bullets.remove(i);
               i--;
               break;
            }            
         }
      }
     
     
      //special update
      try {
         for (int t = 0; t < special.size(); t++) {
            boolean remove = special.get(t).update();
            if (remove) {
               special.remove(t);
               t--;
            }
         }
      } catch (Exception e) {
         // TODO: handle exception
      }

      //enemy and player collision
      for (int i = 0; i < enemies.size(); i++) {
         
         Enemy e = enemies.get(i);
         
         double ex = e.getx();
         double ey = e.gety();
         double er = e.getr();

         double px = player.getx();
         double py = player.gety();
         double pr = player.getr();
         
         double dx = ex - px;
         double dy = ey - py;
         double dist = Math.sqrt(dx * dx + dy * dy);
           
         if (player.getSpecial()) {
            if (dist < (er + 10) + (pr + 10)) {
               e.hit();
            }
         }
      }
     
      //check dead enemies
      for(int i=0; i < enemies.size(); i++) {
         if(enemies.get(i).isDead()) {
            enemies.remove(i);
            i--;
         }
      }
   }

   private void gameRender() {
      g.setColor(Color.BLACK);
      g.fillRect(0, 0, WIDTH, HEIGHT);
      g.setColor(Color.WHITE);
      g.drawString("FPS: " + averageFPS, 10, 10);
      g.drawString("Bullets: " + bullets.size(), 10, 20);
      g.drawString("Enemies: " + enemies.size(), 10, 30);
      g.drawString("X: " + player.x + "  Y: " + player.y, 10, 40);
     
      //draw special
      try {
         for(int i =0; i < special.size(); i++){
            special.get(i).draw(g);
         }
      } catch (Exception e) {
         // TODO: handle exception
      }

     
      //draw player
      player.draw(g);
     
      //draw bullets
      for(int i =0; i < bullets.size(); i++){
         bullets.get(i).draw(g);
      }
     
      //draw enemies
      for (int i = 0; i < enemies.size(); i++) {
         enemies.get(i).draw(g);
      }
   }

   private void gameDraw() {
      Graphics g2 = this.getGraphics();
      g2.drawImage(image, 0, 0, null);
      g2.dispose();
   }

   public void keyTyped(KeyEvent key) {
   }

   public void keyPressed(KeyEvent key) {

      int keyCode = key.getKeyCode();

      switch (keyCode) {
      case KeyEvent.VK_LEFT:
         player.setLeft(true);
         break;
      case KeyEvent.VK_RIGHT:
         player.setRight(true);
         break;
      case KeyEvent.VK_UP:
         player.setUp(true);
         break;
      case KeyEvent.VK_DOWN:
         player.setDown(true);
         break;
      case KeyEvent.VK_Z:
         player.setFiring(true);
         break;
      case KeyEvent.VK_X:
         player.setSpecial(true);
         break;

      default:
         break;
      }

   }

   public void keyReleased(KeyEvent key) {
      int keyCode = key.getKeyCode();

      switch (keyCode) {
      case KeyEvent.VK_LEFT:
         player.setLeft(false);
         break;
      case KeyEvent.VK_RIGHT:
         player.setRight(false);
         break;
      case KeyEvent.VK_UP:
         player.setUp(false);
         break;
      case KeyEvent.VK_DOWN:
         player.setDown(false);
         break;
      case KeyEvent.VK_Z:
         player.setFiring(false);
         break;
      case KeyEvent.VK_X:
         player.setSpecial(false);
         break;

      default:
         break;
      }
   }
}


Player.java
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  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
package com.chimpygames;

import java.awt.*;

public class Player {

   // fields
   public int x;
   public int y;
   public int r;

   public int dx;
   public int dy;
   private int speed;

   private boolean left;
   private boolean right;
   private boolean up;
   private boolean down;
   
   private boolean firing;
   private long firingTimer;
   private long firingDelay;
   
   private boolean special;
   private long specialTimer;
   private long specialDelay;

   private int lives;
   private Color color1;
   private Color color2;

   // constructor
   public Player() {

      x = GamePanel.WIDTH / 2;
      y = GamePanel.HEIGHT / 2;
      r = 5;

      dx = 0;
      dy = 0;
      speed = 6;

      lives = 3;
      color1 = Color.WHITE;
      color2 = Color.RED;
     
      firing = false;
      firingTimer = System.nanoTime();
      firingDelay = 200;
     
      special = false;
      specialTimer = System.nanoTime();
      specialDelay = 5000;
   }

   // functions
   public int getx() {
      return x;
   }
   
   public int gety() {
      return y;
   }
   
   public int getr() {
      return r;
   }
   
   public boolean getSpecial() {
      return special;
   }

   public void setLeft(boolean b) {
      left = b;
   }

   public void setRight(boolean b) {
      right = b;
   }

   public void setUp(boolean b) {
      up = b;
   }

   public void setDown(boolean b) {
      down = b;
   }
   
   public void setSpecial(boolean b) {
      special = b;
   }
   
   public void setFiring(boolean b) { firing = b;}

   public void update() {

      if (left) {
         dx = -speed;
      }
      if (right) {
         dx = speed;
      }
      if (up) {
         dy = -speed;
      }
      if (down) {
         dy = speed;
      }

      x += dx;
      y += dy;

      if (x < r)
         x = r;
     
      if (y < r)
         y = r;
     
      if (x > GamePanel.WIDTH - r)
         x = GamePanel.WIDTH - r;
     
      if (y > GamePanel.HEIGHT - r)
         y = GamePanel.HEIGHT - r;

      dx = 0;
      dy = 0;
     
      if(firing) {
         long elapsed = (System.nanoTime() - firingTimer) / 1000000;
         if(elapsed > firingDelay) {
            GamePanel.bullets.add(new Bullet(270, x, y));
            firingTimer = System.nanoTime();
         }
      }
     
      if(special) {
         long elapsed = (System.nanoTime() - specialTimer) / 1000000;
         if(elapsed > specialDelay) {
            try {
               GamePanel.special.add(new Special(getx(), gety()));
            } catch (Exception e) {
               // TODO: handle exception
            }
           
            specialTimer = System.nanoTime();
         }
      }
   }

   public void draw(Graphics2D g) {

      g.setColor(color1);
      g.fillOval(x - r, y - r, 2 * r, 2 * r);

      g.setStroke(new BasicStroke(3));
      g.setColor(color1.darker());
      g.drawOval(x - r, y - r, 2 * r, 2 * r);
      g.setStroke(new BasicStroke(1));

   }

}
23  Game Development / Newbie & Debugging Questions / Re: Tile mapping on: 2014-02-19 21:06:31
Oh my god...You are kidding me.  Thank you mate!  I can not believe I did not try that.
24  Game Development / Newbie & Debugging Questions / [SOLVED] Tile mapping on: 2014-02-19 20:58:34
Alright, with my current code my map file can look like this.

1  
2  
3  
4  
!Comment line blah blah blah
111111117891111111111111
111111114561111111111111
111111111231111111111111


I am wanting to, parse I believe it would be called.  (Sorry I am still fairly new)

This is what I would like to turn my map file into (This way I am not limited to 9 different tiles)
1  
2  
3  
!Comment line
1,1,1,1,1,1,1,1,1,22,1,1,1,1,1
!and so on



Current 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  
      while (scanner.hasNextLine()) {
         String line = scanner.nextLine();

         // no more lines to read
         if (line == null) {
            break;
         }

         if (!line.startsWith("!")) {
            lines.add(line);
            width = Math.max(width, line.length());

         }
      }
      height = lines.size();

      for (int j = 0; j < height; j++) {
         String line = (String) lines.get(j);
         for (int i = 0; i < width; i++) {
            if (i < line.length()) {
               char ch = line.charAt(i);
               Tile t = new Tile(i, j, Character.getNumericValue(ch));
               tilearray.add(t);
            }

         }
      }


Sorry to have to ask, but where do I go from here, how would I be able to get the numbers between each comma (,) ?
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

Longarmx (37 views)
2014-10-17 03:59:02

Norakomi (28 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (28 views)
2014-10-15 16:18:58

TehJavaDev (52 views)
2014-10-14 00:39:48

TehJavaDev (54 views)
2014-10-14 00:35:47

TehJavaDev (42 views)
2014-10-14 00:32:37

BurntPizza (64 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (77 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!