Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: Instances problem on: 2013-03-05 18:52:24
never mind fixed it I just need to look it see if the tilelist had nulls in it and then just throw those away, my fault , but thanks anyway
2  Game Development / Newbie & Debugging Questions / Re: Instances problem on: 2013-03-05 18:47:19
1  
2  
3  
4  
5  
6  
try{
                     Constructor con = TR.tileClass[i].getConstructor();
                     if(con.newInstance() instanceof Tile){
                         tile = (Tile)con.newInstance();
                     }
                  }catch(Exception e){e.printStackTrace();}


this is the code for what you suggested

 Constructor con = TR.tileClass.getConstructor();

and thats is what is on line 82

but even with the errors it doesn't seem to effect anything so i could do a cheat fix and just remove e.printStackTrace();
3  Game Development / Newbie & Debugging Questions / Re: Instances problem on: 2013-03-05 18:13:35
yeah that was the idea I had in mind but it throws a lot of exceptions.

1  
2  
3  
4  
5  
6  
java.lang.NullPointerException
   at org.TEKGames.World.TiledWorld.LoadWorldFromImage(TiledWorld.java:82)
   at com.test.Game.init(Game.java:21)
   at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:433)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:357)
   at com.test.Game.main(Game.java:40)


It spams that in the console
but for some reason still renders the world

btw I am also using lwjgl and slick2d

and it also says that I need to cast
constructor.newInstance() to tile
4  Game Development / Newbie & Debugging Questions / Instances problem[Solved] on: 2013-03-05 16:51:48
OK, I was working on getting a simple tiled map system up and running to be used as a library, to help make the prototyping process easier.  What I do is I have a register that contains integer array that hold the hexadecimal and a Tile array that just holds the class of the tile.

in the world loading method it take from the data from Tile register and looks for a color that matches. and that brings me to my problem how can I make a new instance of the class that is in the Tile class array; I tried calling newInstance() on it but it just threw an exception and crashed the application.

any help would be appreciated.
5  Game Development / Newbie & Debugging Questions / Re: [Solved]Bullet Logic on: 2012-12-31 20:08:14
Thanks a lot got up and running works like a charm
6  Game Development / Newbie & Debugging Questions / [Solved]Bullet Logic on: 2012-12-31 03:35:11
I looked everywhere for this but couldn't find it. What I wanted to implement into a game is a simple 2d bullet logic that is controlled by the mouse. I understand that you use the slope to determine it but I want to find a guess the ratio between x Velocity and y Velocity to get it to go in the right angle. any help would be greatly appreciated, even if it you are doing it all wrong use this method instead.
7  Game Development / Newbie & Debugging Questions / Slick2d Image problem on: 2012-11-24 00:17:28
I was working on doing some level desing tests and I used the Slick2d getColor(x,y) method. I used it in a for loop that looped through the x and y axis but no matter what it only ever returns the pixel it starts with. I am not sure if this is a bug or what?


 
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
public static Level LoadLevel(String filename) throws SlickException{
       Image map = new Image(filename);
       int w = map.getWidth();
       int h = map.getHeight();
       
       Level level = new Level(w,h);
       Color color;
       for(int y = 0; y < h; y++){
          for(int x = 0; x < w; x++){
              color = map.getColor(x, y);
             System.out.println(x + ", " + y +" Color: " + color);
             Tile tile = new EmptyTile();
             if(color == Color.decode("0x000000")){
                tile = new SolidTile();
             }
             level.SetTile(x, y, tile);
          }
       }
       return level;
   }





Edit: I tried to work it out for a little while longer and it can read the color from the map but when it compairs to the data I have it rejects both of them.
8  Game Development / Newbie & Debugging Questions / Re: Typed Input on: 2012-11-14 17:52:11
I know how to get keyboard input, what I want it to do is record it to a string that can be referenced at a later time.

Edit: I looked at the link you sent and I have tried using that method and it basically spams any key I press, and the method is called key pressed, so i am not sure whats going on.
9  Game Development / Newbie & Debugging Questions / Typed Input on: 2012-11-14 15:57:23
I am using the slick2d API and I wanted to make a input system that its typed. basically if I wanted to name a new game save or character or type in a IP the same way minecraft does, how would I go about doing this with slicks Input system.
10  Game Development / Newbie & Debugging Questions / Re: tile map collision detection on: 2012-10-30 07:28:34
You sort of have the right idea. As for collision I do a comparison between the location of all four sides. Like if the right side of block a is greater than the left side of block and the left side of block a is less than the right side of block b : there will be a collision on the x axis. But that just gives you x and it would collide anywhere on the y axis so you do something very similar to the y a is just with the top and bottom.


Then in the update method have something like if (!solid){x+= xvelocity; y+= yvelocity };  and if x+xvelocity intersects another x of a tile  solid = true so the it dosent update

Hope this helps.
11  Game Development / Newbie & Debugging Questions / Re: SideScroller Problem on: 2012-10-30 07:00:11
I googled it and I love is that was what I needed.  Thanks
12  Games Center / WIP games, tools & toy projects / Re: [WIP] - Space based first person shooter - Haxel on: 2012-10-28 23:22:59
Looks awesome cant wait to play.
13  Game Development / Newbie & Debugging Questions / SideScroller Problem on: 2012-10-28 23:18:35
I have been working on a sidescroller for about 2 weeks or so. but I was having trouble with I tile that I made to conduct electricity.

how it works is there is a button tile and when you stand on it it trigers the wire and then opens the door. I just use a boolean for each tile to say if its powered or not. Basically my problem the power is doubling back and a wire is powering a wire, not a button.

so How to I have it so that the electricity can go through tons of different* ways but only one at a time.


*By tons I mean 8 one for every tile next to the tile.

Broken Wire Tile Code

http://www.java-gaming.org/?action=pastebin&id=292

all its doing is looking to see if its powered in the update method
and the if(level != null) is important because its tends to load without init'ing the level properly.
14  Game Development / Newbie & Debugging Questions / Re: Image maploading on: 2012-10-28 23:09:39
Ok, Thanks
15  Game Development / Newbie & Debugging Questions / Image maploading on: 2012-10-23 03:06:03
I am not having trouble with the map Loading. my Original one used a .txt doc to find were. But insted I wanted  it make it from a Image, I would prefer if it used the Image class in Slick2d, but I will also settle for a BufferedImage Version.

Thank you in advance for Help.
16  Game Development / Newbie & Debugging Questions / Re: [Update] fixed: Tile Map Design Problem on: 2012-10-23 01:00:06
ok I fixed it, what i needed to so it turn the change the getTile method into getTile(int x ,int y) and the Tile class init's the x and y.

thank you for all the help.

Hopefully the game will be done soon.
17  Game Development / Newbie & Debugging Questions / Re: Tile Map Design Problem on: 2012-10-22 22:24:02
basically to sum it up I want to make a instance of every tile that appears on the screen, because as of now it is making one instance per tile type so the x and y cores for any given tile are the last occurrence of that tile in the map. so what I want to do is every time a tile is set at the start it makes a new version of it.

you responses would be greatly appreciated.
18  Game Development / Newbie & Debugging Questions / Re: Tile Map Design Problem on: 2012-10-22 07:32:09
Just some quic clarifacations the static tile list was there from my old tile referance system. But I am not compleatly sure the new one is good so I left the code laying around. As for the calling it 20 times that occors in the render method when it's getting the tile. The get tile method calls from a 2d array that was loaded from a txt file, basically what I ment was that I have 20 wiretile recorded to the array. And the tile updating inside the entity loop was amistake :p. sorry for all the extra guff in my code I am not the neatest programer.

So from what I gather I need to set the tile Pos. in the set tile method. I am not sure if this is what you mean or maybe you have something better in mind. Thank you for all the help.

WireTile.java

http://www.java-gaming.org/?action=pastebin&id=288

This is basically it when it comes to the wire tile. But I removed the power checking didn't work in the first place.
19  Game Development / Newbie & Debugging Questions / Re: Tile Map Design Problem on: 2012-10-22 05:12:56
Ok ley me try and explain this a little better. The problem I was having is the wiretile in the map is used like 20 time so far but it calls all 20 of them through one class. I want it make copy's of every wiretile so that I can have perminate x and y cords for each tile instead of them swarming through one class per tile. So basically my code to the wire was plans to be something like if(level.getTile(x-1,y).powered) powered = true;  the x and the y would be the tiles position so this would look at the tile to your right to see if it's powered and if it is it would turn on too.

I hope this helps.
20  Game Development / Newbie & Debugging Questions / [Update] fixed: Tile Map Design Problem on: 2012-10-22 04:28:20
I have been working on a Puzzle game,(basically its Like Portal in 2d). the main Ideas is going to be to get a Box on a button so that you can get out the door. But I ran into a design problem with the Tile engine. How its works is it calls entities from an array in the Tile file so as to get there id's and then compairs them to a .txt file to see were they go.

I designed the Door and Button to be Tiles and then I would use another Tile called wireTile. basically it calls every tile of one sort through the same class, so I cant have a perminiate x, or y to any Tile. Do you know anyway to give each tile a more permintate position?

Level.java
http://www.java-gaming.org/?action=pastebin&id=286


Tile.java
http://www.java-gaming.org/?action=pastebin&id=287

here is my Tile and level code.
Pages: [1]
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (73 views)
2013-05-17 21:29:12

alaslipknot (85 views)
2013-05-16 21:24:48

gouessej (114 views)
2013-05-16 00:53:38

gouessej (109 views)
2013-05-16 00:17:58

theagentd (120 views)
2013-05-15 15:01:13

theagentd (109 views)
2013-05-15 15:00:54

StreetDoggy (154 views)
2013-05-14 15:56:26

kutucuk (176 views)
2013-05-12 17:10:36

kutucuk (173 views)
2013-05-12 15:36:09

UnluckyDevil (182 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.171 seconds with 21 queries.