Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (577)
games submitted by our members
Games in WIP (498)
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 ... 5
1  Game Development / Newbie & Debugging Questions / Re: Examples on: 2014-01-30 22: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.
2  Game Development / Newbie & Debugging Questions / Examples on: 2014-01-30 21: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?

3  Game Development / Newbie & Debugging Questions / Re: Static tile properties with Tiled on: 2014-01-30 21: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.
4  Game Development / Newbie & Debugging Questions / Re: Static tile properties with Tiled on: 2014-01-27 20: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.
5  Game Development / Newbie & Debugging Questions / Re: Static tile properties with Tiled on: 2014-01-25 03: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.
6  Game Development / Newbie & Debugging Questions / Re: Static tile properties with Tiled on: 2014-01-25 03:35:48
It just seems like it would be redundant to draw a whole extra layer every time just for collision. That's how I did it in my pacman game, but being there are a lot more tiles that will always be blocked and quite a few maps...It doesn't seem like that would be a good approach for this.
7  Game Development / Newbie & Debugging Questions / Static tile properties with Tiled on: 2014-01-25 03:07:02
I've been searching around and cant seem to find it..I may be wording it wrong. Is it possible to make tile properties static? Like, for instance:

If i make a map and set a blocked property for all of the blocked tiles, then when I go to make a second map, I don't want to have to set all the same tiles with blocked again...Is there a way to do this in tiled or with code? Or do I need to learn to make my own map editor?
8  Game Development / Newbie & Debugging Questions / Re: Confused about NPC's and map editor on: 2014-01-20 04:34:39
Sorry. I'm scatter-brained right now haha. I'm making a farming game similar to harvest moon..like i've seen so many other people making...haha. I've had the idea for a few years now being a fan of the series. Just never got around to trying to make it. I'm using a tiled system with Tiled as an editor. I've already got it setup and the character walking around and everything. I know I could do it using the object layer and object properties. I could use a variable on each object specifying what type of NPC it is and the different parameters needed for that NPC..

It just seems like there is a better way. I use to develop for a game called GraalOnline and I guess i'm use to that and trying to make it similar. In the map editor you can place an NPC on the map which you can set an image for it by default or you can script it as well as the actions.
9  Game Development / Newbie & Debugging Questions / Re: Confused about NPC's and map editor on: 2014-01-20 04:13:21
Well, that's the thing. I do need to specify where they are. For instance, I have a character standing in front of a house that the player can talk to by walking up to.
10  Game Development / Newbie & Debugging Questions / Confused about NPC's and map editor on: 2014-01-20 03:16:11
I'm working on a 2d orthogonal tiled game and i'm not so sure the tiled map editor will be enough...This is my first major project..I've made a few small games like brickbreaker and pacman...I will be using 16x16 tiles and moderately small maps. Probably 64x64..So i'm going to have multiple maps. I'm not sure what to do, because I don't want to have to set the tile properties for every single map I make..What can I do?

Also, i'm not sure how to make the NPC's...I'd like to be able to have animals running around, people that you can talk to, etc. My first thought was to use an object layer...But this won't work. I'll need to be able to set images, make the NPC talk, and things like that. I know i'm going to need some type of scripting system, but i'm not sure how I can implement it into tiled to add to the maps...It seems kind of redundant to hard-code the NPC's into the game..They will change.

In the end, I want to be able to take this game online so players will be able to create maps...I'm nowhere near ready to do it online yet...Thus why i'm making it single player for now. I hope this makes sense, I tried to explain it in the best way possible.
11  Game Development / Newbie & Debugging Questions / Re: LibGDX - make motion blur for 2D game on: 2014-01-19 01:24:26
I don't know anything about shaders and am still a noob..But if I was trying to create the same effect, I would render an image of the object a few times a few pixels behind the object each time and lower the alpha of the image a little more then the one before it. Should give you the same effect...But like I said, i'm a noob..There's probably an easier way of doing it that pertains to what you're doing.
12  Game Development / Newbie & Debugging Questions / Re: Noob thinking about trying to use a library on: 2014-01-14 21:46:57
For what you're trying to do, you need to start learning LibGDX. It handles most of the redundant things for you so all you have to do is basically code your content but is still flexible enough to do anything you want. I'm working on a similar type game (By similar I mean a 2d tiled game.)

Get LibGDX up and running and watch dermetfans tiled tutorial. It's GREAT! You will learn enough to get you started.

P.S. Thanks dermetfan for the hardwork put into your tiled tutorial. I haven't had a chance to go through your other tutorials yet but thanks for those too! I spoke with you the other day on youtube. I'm the one making the farming type game. (Jman)
13  Game Development / Newbie & Debugging Questions / Re: Couple questions about camera and movement on 2d tiled game on: 2014-01-08 20:32:00
nerb-

That's almost exactly what i'm already doing in the code..I'm just having issues determining the max_x and max_y.

trollwarrior-

Thanks. That makes a little more sense. I'm not using my own camera class, just have it thrown in but i'm thinking about changing that just to make it a little easier to work with the camera. I'm not sure I follow your example 100% but it's definitely a help.
14  Game Development / Newbie & Debugging Questions / Couple questions about camera and movement on 2d tiled game on: 2014-01-08 04:53:06
Hey guys

I'm working on a 2d top-down tiled game. I'm doing it to learn but will probably turn it into a another farming game similar to harvest moon. I've got the map loaded and character displayed and all that, but i'm having a little bit of trouble with a couple things.

I've got my camera set up and it follows the player around...but i'm having trouble getting it to stop scrolling when the player gets near the end of the map. Below is my code. I've only done the x axis and i've just been playing with the values.

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  
public void render() {      
      //handleInput();
     
      GL10 gl = Gdx.graphics.getGL10();
      gl.glClearColor(0, 0, 0, 1);
      gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
      gl.glViewport((int)glViewport.x, (int)glViewport.y, (int)glViewport.width,(int) glViewport.height);
     
      map.renderer.setView(camera);
      map.render();
     
      map.renderer.getSpriteBatch().setProjectionMatrix(camera.combined);
      map.renderer.getSpriteBatch().begin();
     
     
     
      mainPlayer.Draw((SpriteBatch) map.renderer.getSpriteBatch());
     
      map.renderer.getSpriteBatch().end();

//move camera to follow player  
  if (mainPlayer.getPosition().x >= 15 && mainPlayer.getPosition().x <= 30) {
      camera.position.x = mainPlayer.getPosition().x;
     
      }
      System.out.println(camera.position.x);
      camera.position.y = mainPlayer.getPosition().y;
     
      camera.update();
      camera.apply(gl);
     
   }


below is a picture of what i'm talking about. I don't want the black area to be seen.




I've been searching around a bit and I know how i'm going to do my collision detection. I'm going to do it the same way dermetfan does it in his video tutorial. How would be the best way to keep the player on the map? Just do a check to make sure the cell isn't null? Also, i'm a bit confused as how to warp to the next map when the player hits the edges of the map.


Also, this is more of an opinion from you guys, but what should I do next? I know this is a pretty dumb question, but i'm doing this to learn as well as turning it into a game..I thought about adding particle effects next because they interest me. I still have quite a few things to implement though..time system, gui, tools, and NPC's which I still have no clue how i'm going to do.
15  Game Development / Newbie & Debugging Questions / Re: What is up with this stretching? Can't get camera right. on: 2013-12-31 22:51:04
I lied..I still haven't gotten it. all i've been able to do is move the viewport for the camera around..therefore moving the actual camera and not the level/map....
16  Game Development / Newbie & Debugging Questions / Re: What is up with this stretching? Can't get camera right. on: 2013-12-31 22:23:44
I fixed the stretching finally by applying the viewport to the render method. The wiki helped.


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
public void render() {      
      GL10 gl = Gdx.graphics.getGL10();
      gl.glClearColor(1, 1, 1, 1);
      gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
      gl.glViewport((int)glViewport.x, (int)glViewport.y, (int)glViewport.width,(int) glViewport.height);
      camera.update();
      camera.apply(gl);
     
      batch.begin();
      map.render(batch);
      batch.end();
   }


It's frustrating as hell getting back into this.
17  Game Development / Newbie & Debugging Questions / What is up with this stretching? Can't get camera right. on: 2013-12-31 21:55:49
Hey guys..I've fallen off for a little while but getting back into it now..I'm having trouble getting my camera to work right..I have a 30x30 map or 32x32 tiles. I set the screen size to 960x960 as this would show all tiles...When I resize the window, it stretches or makes everything smaller if I make the window bigger or smaller. I've been searching for a while and I know it's something dumb that i'm missing, but I can't put my finger on it. I've got my main class and my map class

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
public void create() {      
     
      float w = Gdx.graphics.getWidth();
      float h = Gdx.graphics.getHeight();
     
      float aspectRatio = h/w;
     
      batch = new SpriteBatch();
     
      camera = new OrthographicCamera();
      //1 is temporary camera x and y
     camera.setToOrtho(false,(w/h)*1,(w/h)*1);
     
     
   
      camera.update();
     
      map = new map(camera,"map");
      map.setRenderView(camera);
         }


map 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  
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.maps.*;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;

public class map {
   OrthogonalTiledMapRenderer render;
   TiledMap currentMap;
   MapLayer mLayer1;
   
   float unitScale = 1f/32f;
   
   public map(OrthographicCamera cam, String mapName) {
     
      currentMap = new TmxMapLoader().load("data/test1.tmx");
      render = new OrthogonalTiledMapRenderer(currentMap,unitScale);
     
     
   }

   public void setRenderView(OrthographicCamera cam) {
      render.setView(cam);
   }
   
   public void render(SpriteBatch batch) {
      render.render();
     
   }
   
}


I've been messing with the code so much from searching and playing with it that now it seems like it's rendering 1 HUGE tile to the screen. i'm sure it has something to do with the SetToOrtho call but i'm not exactly sure how to fix it.
18  Game Development / Newbie & Debugging Questions / Re: How to read map for A* on: 2013-10-26 05:55:23
I was wondering the same thing..Thanks for the attempt at helping though!
19  Game Development / Newbie & Debugging Questions / Re: How to read map for A* on: 2013-10-26 05:32:47
Thanks anyways for the help! lol

I'm just reading away..hopefully I can get it figured out..
20  Game Development / Newbie & Debugging Questions / Re: How to read map for A* on: 2013-10-26 05:14:40
See, that's the problem i'm having. It's a tiled tmx map. I've figured out how to add the blocked tiles to the arraylist..but i'm not so sure how to add all tiles to a multidimensional array as I would if I hardcoded the map.
21  Game Development / Newbie & Debugging Questions / Re: How to read map for A* on: 2013-10-26 04:42:56
That's the page i'm getting my a* information from. I see what you're saying. So I can make another array list just for the walkable tiles which makes sense now.

How would I just check the tiles close to the ghost? I can take the x and y of the ghost and then check through the arraylist and find the tile that the ghost is on...but i'm not sure how I would check the 8 tiles surrounding the ghost?
22  Game Development / Newbie & Debugging Questions / Re: How to read map for A* on: 2013-10-26 04:29:22
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
 for (int y = 0;y < blockedLayer.getHeight();y++ ) {
         for (int x = 0; x < blockedLayer.getWidth();x++) {
                     
            //Set blocked tiles
           if (blockedLayer.getCell(x,y)!=null) {
            Rectangle tempRect = new Rectangle(x*16,y*16,16,16);
            blockedTiles.add(tempRect);
           
            if (blockedLayer.getCell(x, y)==null) continue;
           
            }


That's basically what I do here, except I only add the blocked tiles to an arraylist. I guess I could make another list and add the blocked and non-blocked tiles..I just don't see how I could implement that into the a* algorithm.

This is the first time i've ever attempted pathfinding, so please forgive me if I sound like an idiot. I just can't figure out how to get started.
23  Game Development / Newbie & Debugging Questions / Re: How to read map for A* on: 2013-10-26 04:03:01
I'm thinking that may be what I need to do...but i'm not exactly sure how. I wrote this a couple months ago and am coming back to it.

Here is my map class.

http://pastebin.com/mde2gV0d
24  Game Development / Newbie & Debugging Questions / How to read map for A* on: 2013-10-26 03:36:04
Hey guys, i'm back to work on my pacman game..I'm trying to implement a star pathfinding for the ghosts to follow the player...I'm using Tiled to load a map..I've got a separate layer for blocked tiles and i'm loading that layer to an array of blocked tiles...

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
   for (int y = 0;y < blockedLayer.getHeight();y++ ) {
         for (int x = 0; x < blockedLayer.getWidth();x++) {
                     
            //Set blocked tiles
           if (blockedLayer.getCell(x,y)!=null) {
            Rectangle tempRect = new Rectangle(x*16,y*16,16,16);
            blockedTiles.add(tempRect);
           
            if (blockedLayer.getCell(x, y)==null) continue;
           
            }


I'm trying to figure out how to get the blocked and non-blocked tiles together so I can start with the a*
25  Game Development / Newbie & Debugging Questions / Re: Complete Newbie on: 2013-09-17 20:40:15
Yeah, just start coding and playing around with stuff. That's what i've done. I'm still a newbie but i've put together a few smaller games. Let me know if you need any help. These are my favorite types of games to make.
26  Game Development / Newbie & Debugging Questions / Re: Having issues getting started with scene2d.ui on: 2013-09-17 20:36:32
You're awesome man! Thank you!

Now to get to work. Would it be too difficult to make a tabbed interface with scene2d.ui?
27  Game Development / Newbie & Debugging Questions / Re: Having issues getting started with scene2d.ui on: 2013-09-15 05:28:33
What I'd suggest doing is just playing around with it, create a different project to get used to it. Look up some example code or project and copy that code and just, well, play with it!

That's basically what i'm doing. The problem i'm having really is with Skin. I've found this: http://code.google.com/p/libgdx/wiki/Skin
But i'm having trouble getting it to work.
28  Game Development / Newbie & Debugging Questions / Re: Having issues getting started with scene2d.ui on: 2013-09-15 05:08:29
Thanks. I've already found that. That's the one resource i've been using but it doesn't necessarily get me started. I've read over it and I see the components of scene2d.ui..But I don't know how to apply it.
29  Game Development / Newbie & Debugging Questions / Having issues getting started with scene2d.ui on: 2013-09-15 05:04:09
I'm trying to figure out how to use scene2d.ui and i'm having a bit of trouble. I've been looking around but most of the documentation I found is out of date..and others I can't tell if it's old or new. Can anyone point me in the right direction or give me some tips/suggestions? My game will mainly consist of menu screens. It's a tycoon game. You will purchase inventory, upgrades, etc. Then you start the day and it's all automated and will show the screen of customers walking to the store and purchasing. This will either be an isometric area or orthogonal.

Thanks guys!
30  Game Development / Newbie & Debugging Questions / Re: Tycoon type system on: 2013-09-15 03:59:00
That's the problem. I'm not exactly sure what it's capable of. I'm trying to get it going but am having a bit of a problem as to where to start because of the old documentation.
Pages: [1] 2 3 ... 5
 

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (22 views)
2014-04-15 18:08:23

BurntPizza (17 views)
2014-04-15 03:46:01

UprightPath (31 views)
2014-04-14 17:39:50

UprightPath (15 views)
2014-04-14 17:35:47

Porlus (31 views)
2014-04-14 15:48:38

tom_mai78101 (57 views)
2014-04-10 04:04:31

BurntPizza (115 views)
2014-04-08 23:06:04

tom_mai78101 (214 views)
2014-04-05 13:34:39

trollwarrior1 (182 views)
2014-04-04 12:06:45

CJLetsGame (189 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
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!