Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (541)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
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 3 ... 6
1  Game Development / Newbie & Debugging Questions / Re: Tower Defense pathfinding? on: 2014-11-23 22:32:12
Yeah, there is some good stuff on there! Thanks.

I'm rewriting this now to use tiled instead..It's too hard to manage in the array...My question is, how do I set up a grid to use a* with tiled? I tried this before and was unsuccessful. That's part of the reason, I decided to do it from scratch as I would already have a grid..I know it's something simple, but I don't see it.
2  Game Development / Newbie & Debugging Questions / Re: Tower Defense pathfinding? on: 2014-11-23 21:48:26
That is awesome! Thank you Gibbo. A simple search probably would have found that for me! I didn't think about searching for tower defense specifics.

I agree, CC. I just needed some reassurance!

I just hope I can stick with this without getting bored. I'm only developing it for the experience, but I need to finish something completely so I can move forward to the games I have been planning for months.
3  Game Development / Newbie & Debugging Questions / Re: Tower Defense pathfinding? on: 2014-11-23 21:00:12
That's what I'm going for. Just trying to figure out the best way to calculate the pathfinding..there aren't many obstacles and it's just from A to B, so I feel like a* might be too much..

This is the first time I've ever done any type of pathfinding.
4  Game Development / Newbie & Debugging Questions / Re: Tower Defense pathfinding? on: 2014-11-23 20:47:18
What do you mean? Who does?
5  Game Development / Newbie & Debugging Questions / Tower Defense pathfinding? on: 2014-11-23 19:57:37
Hey guys, i'm working on a small tower defense game using LibGDX. I'm probably going to put an android port on the play store.

So, the game is coming along pretty nicely so far. I'm just trying to figure out the best pathfinding method...I was thinking of using A* but I think that may be a little much for what I need...

I started the project using a multidimensional array for the map, but i'm now thinking of switching to using tiled so it is easier to manage larger maps..I don't know if there is another way to do it using tiled, I do know I was having trouble using the A* method with tiled...

Basically, the enemies will follow a path from A to B...I could define waypoints, but it seems like there could be an issue with enemies running into each other, etc.

Any suggestions or tips?
6  Game Development / Newbie & Debugging Questions / Re: 2D Array with ArrayList for map on: 2014-11-14 04:13:47
I see. I think I know what's going on. It's with my camera.
7  Game Development / Newbie & Debugging Questions / Re: 2D Array with ArrayList for map on: 2014-11-14 04:04:33
Change the
new Vector2(y, x)
to
new Vector2(x, y)
but leave everything else as-is.

..You're awesome. So why does the iterator need to be reversed but not the rest? Is it the order in which it iterates?

Should I be disposing of the tempTile somehow before I start on the next iteration? I changed one of the bottom lines to another color and it's making the whole line that tile..It doesn't make sense. I've gone through the code.
8  Game Development / Newbie & Debugging Questions / Re: 2D Array with ArrayList for map on: 2014-11-14 03:55:11
I switched them around in my tile class like so:
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  
private void loadLevel() {
   int[][] levelData = new int[][] {
         {0,0,0,0,1,0,0,0,0,0},
         {0,0,0,0,1,0,0,0,0,0},
         {3,3,3,3,1,3,3,3,3,3},
         {0,0,0,0,1,0,0,0,0,0},
         {0,0,0,0,1,0,0,0,0,0},
         {0,0,0,0,2,1,0,0,0,0},
         {0,0,0,0,0,1,0,0,0,0},
         {0,0,0,0,0,1,0,0,0,0},
         {0,0,0,0,0,1,0,0,0,0},
         {0,0,0,0,0,1,0,0,0,0}
   };
   
   
     
   
   for (int y = 0; y < 9; y++) {
      for (int x = 0; x < 9; x++) {
         Tile tempTile = new Tile(levelData[y][x],new Vector2(y,x));
         tileList.add(tempTile);
         
         
      }
}



}

public void Render(SpriteBatch batch) {
   
   for (int i = 0; i < tileList.size(); i++) {
      tileList.get(i).render(batch);
   }
}


But in my tile class where I actually draw them, it calls for x and y so I left them..Do I use y for everywhere x is referred and vice versa?

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  
   public void render(SpriteBatch batch) {
      if (tileType == 0) {
         batch.draw(new TextureRegion(tileTexture, 0, 0, 16, 16), tilePos.x,
               tilePos.y);

      } else {
         if (tileType == 1) {
            batch.draw(new TextureRegion(tileTexture, 0, 16, 16, 16),
                  tilePos.x, tilePos.y);

         } else {

            if (tileType == 2) {
               batch.draw(new TextureRegion(tileTexture, 16, 0, 16, 16),
                     tilePos.x, tilePos.y);

            } else {

               if (tileType == 3) {
                  batch.draw(new TextureRegion(tileTexture, 16, 16, 16,
                        16), tilePos.x, tilePos.y);
               }
            }
         }
      }
   }
9  Game Development / Newbie & Debugging Questions / Re: 2D Array with ArrayList for map on: 2014-11-14 03:48:05
Okay..I got it working but it's drawing everything rotated 90 degrees counter clockwise..
10  Game Development / Newbie & Debugging Questions / Re: 2D Array with ArrayList for map on: 2014-11-14 03:14:22
I've not even used hashmaps yet. Need to learn them next.
11  Game Development / Newbie & Debugging Questions / Re: 2D Array with ArrayList for map on: 2014-11-12 19:24:38
I like using x and y as it is what i'm used to from scripting on another game. It works well. Ive used tiled and its simple for maps. Its too much for what I need on this game though and id like to learn what it's doing. I need the experience. I think ive figured out a good way to do this. When i get home, im going to continue working on it. Im hoping to be able to stay with it longer.

Ive got a much bigger project that i want to do but i am nowhere near ready...so im just trying to learn everything i can.
12  Game Development / Newbie & Debugging Questions / Re: 2D Array with ArrayList for map on: 2014-11-12 03:23:10
Ah, I see. I could have googled that, I apologize for the dumb questions! Just a bitch to do when it's running so slow. I'm not closing it or doing anything. It stops when it has the NPE error.
13  Game Development / Newbie & Debugging Questions / Re: 2D Array with ArrayList for map on: 2014-11-12 03:03:34
That makes sense..Can't believe I missed that. so I need to do something like

List<Tile> tileList = new List();
This doesn't seem to work..do I really need the <Tile>?

On a completely unrelated note...What would cause the compiler to run like complete shit after i've ran the game a couple times...It runs perfectly fine when I first start it up but as soon as i've run the game two or three times, it freezes up every time I do anything. Just moving the cursor around takes a few seconds. I think that's a big part of my problem. It is extremely frustrating to debug like this.
14  Game Development / Newbie & Debugging Questions / Re: 2D Array with ArrayList for map on: 2014-11-12 02:51:17
Definitely somebody I was hoping to hear from!

I haven't really started into any of the advanced stuff yet though..That's what i'm saying. I've made a couple small games like pong, breakout, and pacman...I shouldn't be having these issues still..I don't open eclipse for a couple months, and when I get started back in, I feel like I know less than I did..If that makes sense.

It's the little things that get me...for example, I rewrote that using a List and i'm getting a null pointer exception when I add the tile to the list...which I set the title in the line directly above it, so it's not null...

1  
2  
3  
4  
   for (int x = 0; x < 9; x++) {
      for (int y = 0; y < 9; y++) {
         Tile tempTile = new Tile(levelData[x][y],new Vector2(x,y));
         tileList.add(tempTile);
15  Game Development / Newbie & Debugging Questions / 2D Array with ArrayList for map on: 2014-11-12 02:07:42
So, here I am again..Feeling like a newbie. It's been a while since i've coded anything and i'm trying to get back into it again...so i'm making a tower defense game. I'm just playing around right now with the map.

Basically, i've got a Level class and a Tile class. The tile class just holds the tile information like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
public class Tile {

   private int tileType;
   private boolean walkable;
   private Vector2 tilePos;
   public Tile(int type, Vector2 pos) {
      tileType = type;
      tilePos = new Vector2(pos);
   }
   
   
public Vector2 getPos() {
   return tilePos;
}
   
public boolean isWalkable() {
   return walkable;
}


In my Level class, i've got a 2d array which determines which tile is where:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
private void loadLevel(int width,int height) {
   int[][] levelData = new int[][] {
         {0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0}
   };
   


Simple...So what i'm trying to figure out, is how to actually keep track of the tiles if that makes sense. I'm going to put my render method in the level class and will iterate through the level to draw the maps...I was going to use a for loop and add each tile to an arraylist, then iterate through the arraylist in my render method to draw each tile in the correct place and the correct tile...But, I remember reading that an arraylist would be a bad way to do this and it just doesn't seem like a good way...

I feel like i've taken one step forward and 10 back every time I take a break from java. I should be way more advanced than I am for as long as I have been messing around with java. Any suggestions or information would be greatly appreciated. I do well for a while, then get stuck and take a break, come back and am in the situation I am in now. Very frustrating...
16  Games Center / WIP games, tools & toy projects / Re: RPG Project on: 2014-09-12 02:50:37
Looks good. I'm doing a similar style game with a different style of play. I'm still learning though. I'm curious as to why so many packages. I've been trying to figure out how to organize everything a little better, but what are the benefits to doing it that way? Do you just import the packages you need into every class?

So far, every little game i've done has only had one package. I'm trying to figure out my next step in learning. I've made a few small games and read through my java books. I am getting ready to start reading up on entity systems so I can work on my 2d orthogonal tile-based game. I think i'm ready and work for a bit, then realize I need to read up on other methods. I've gotten a basic game that loads a map and has a player walking around but just doesn't seem organized and gets a little overwhelming to get any further.

Sorry for rambling. I don't mean to try to hijack the thread lol. To the OP, the game looks great so far!
17  Games Center / Featured Games / Re: [Slick2d] Retro-Pixel Castles > NEW EDITOR RELEASE: 7-10-2014!! < on: 2014-07-14 00:03:25
Sorry if you've already answered this but I didn't go through all the pages. What do you use for your graphics? I've been having problems finding what I need and I don't know any artists. I'm going to attempt to make my own. Also, does anybody know of any decent websites to find artists?
18  Game Development / Newbie & Debugging Questions / Re: wtf? eclipse and libgdx problem... on: 2014-07-08 18:59:09
19  Game Development / Newbie & Debugging Questions / Re: wtf? eclipse and libgdx problem... on: 2014-07-08 18:54:01
Yes.
20  Game Development / Newbie & Debugging Questions / Re: wtf? eclipse and libgdx problem... on: 2014-07-08 18:24:42
The video had nothing to do with the issue i'm having. Basically, in eclipse, I have no run configurations. When I right click on the desktop project and go to Run As..There are no options there. It doesn't say Java Application, Android Application, or any of that..
21  Game Development / Newbie & Debugging Questions / Re: wtf? eclipse and libgdx problem... on: 2014-07-06 18:58:51
Sure didn't. Just read the guides. I'll check it out though. I figured the videos were just a copy of the guides. Can you post a link to where that is located? I must have missed it...Sorry, I had been up for about 24 hours because of work and was a little drunk when I posted that last night. I do appreciate it though!
22  Game Development / Newbie & Debugging Questions / wtf? eclipse and libgdx problem... on: 2014-07-06 05:37:23
I installed eclipse luna 64 bit and java7 as well as libgdx..I noticed libgdx is now powered by gradle which is different...Well i've made my project, but can't get it to even run the generated code...I literally imported the gradle project and right clicked on the desktop launcher..but when I go to Run As, it doesn't have the options like i'm used to. It just says Configuration..I tried to set a configuration profile up but it's not working..says could not load or find main class. I've been searching around but cannot find a solution. When I click search to try to set up a main class under the configuration, nothing comes up.

I'm so lost. I don't get it. Before, it was simple to get this to run...I'm not sure what i'm doing wrong. I miss the old way lol.
23  Game Development / Newbie & Debugging Questions / Re: Box2d and 2d tiled games on: 2014-06-29 21:35:41
Oh, sorry. I thought I wrote top-down. I could see the need for box2d in a platformer though. I'm making a 2d top down tiled game. I don't think i'll have MUCH need for physics, but possibly a little. It's the farming game i've been working on for some time. But i've heard of using box2d for collisions as well. I've been trying to find a good book or some good source materials but have not had much luck.
24  Game Development / Newbie & Debugging Questions / Box2d and 2d tiled games on: 2014-06-29 21:00:32
Is there any benefit to using box2d in a tiled map game? I plan on using box2d lights of course, to get the lighting effects...I've been coding off and on for about a year. Got a new PC and i'm getting back into it. I'm still basically a 'newbie' though. I want to finish this game this time!
25  Discussions / General Discussions / Game Code Examples on: 2014-06-29 20:25:48
I'm looking for some examples of 2d tiled games using LibGDX. Does anyone know where I can find any of them? Ive been searching around but haven't come across anything really useful yet. I just want to look over it and see how certain things have been done.
26  Game Development / Newbie & Debugging Questions / Re: Examples on: 2014-01-30 21:02:13
I've watched a few of those already. They're good tutorials and all, I would just rather play around with the code. I get bored with the videos too quickly. I watched dermetfans. Those were my favorite so far.
27  Game Development / Newbie & Debugging Questions / Examples on: 2014-01-30 20:59:13
This is an extremely dumb question and I apologize in advance...But where can I find examples of games and source code? Back in the day, when I was playing around with Visual Basic and some of the older languages, I could always go on planetsourcecode.com and see examples of how people have done things and I learned pretty quickly...I've found a few examples on the wiki but only a few games and nothing that even pertained to what i'm doing.

I'm having trouble figuring out how to organize my classes, what to make each class do, etc. For instance, for my 2d tiled game, I have a Map class which loads and renders the map...Sometimes I look at the code and think it may need to be split up, but am not really sure. Sometimes I have trouble making the classes work together. I hope I explained this correctly as i'm having trouble finding the words to explain what i'm asking lol. I'm new to Java, but I have read through a java book and I feel pretty comfortable with the code itself...It's just placement and putting it into action.

So basically, is there anything like planetsourcecode for us that I can see projects and see how they did things?

28  Game Development / Newbie & Debugging Questions / Re: Static tile properties with Tiled on: 2014-01-30 20:07:31
I didn't think about that. That's a great idea. I'll just do all of my tile properties in code at run-time. I didn't even know you could do that but that will take care of my problem i'm pretty sure.
29  Game Development / Newbie & Debugging Questions / Re: Static tile properties with Tiled on: 2014-01-27 19:40:12
you can externalised the tileset in the editor


Like he said you can right click the .txm file and edit it manually (its written in XML i think) make one tile property then copy paste it to the tles you need on different maps.


I think you are the only one who understands what i'm asking..

I already know how i'm doing my collision. Each blocked tile will have a property set as blocked. In tiled, I don't want to go through EVERY one of my maps setting EVERY tile property again. I'd rather set it once in a map or in code and not have to set the tiles properties again every time I make a new map as I have a lot of maps.

I could edit the map properties, but I don't think libgdx reads maps in XML. They are encoded.
30  Game Development / Newbie & Debugging Questions / Re: Static tile properties with Tiled on: 2014-01-25 02:55:53
I know..That's exactly what i'm doing, but I have multiple maps. I'm trying to figure out how to set it once and every map that I make with that tileset has the same properties so I don't have to set the properties a hundred times. I'm not doing anything with a collision layer. That's what syath was suggesting but it doesn't apply to my game.
Pages: [1] 2 3 ... 6
 

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

The first screenshot will be displayed as a thumbnail.

Mr.CodeIt (24 views)
2014-12-23 03:34:11

rwatson462 (55 views)
2014-12-15 09:26:44

Mr.CodeIt (45 views)
2014-12-14 19:50:38

BurntPizza (91 views)
2014-12-09 22:41:13

BurntPizza (113 views)
2014-12-08 04:46:31

JscottyBieshaar (83 views)
2014-12-05 12:39:02

SHC (92 views)
2014-12-03 16:27:13

CopyableCougar4 (100 views)
2014-11-29 21:32:03

toopeicgaming1999 (160 views)
2014-11-26 15:22:04

toopeicgaming1999 (163 views)
2014-11-26 15:20:36
Resources for WIP games
by kpars
2014-12-18 10:26:14

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