Java-Gaming.org Hi !
 Featured games (84) games approved by the League of Dukes Games in Showcase (604) Games in Android Showcase (171) games submitted by our members Games in WIP (654) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
 Show Posts Pages: [1]
 1 Game Development / Newbie & Debugging Questions / Re: [Slick2d] [input] Keys and mouse firing too fast on: 2012-06-13 02:14:45 isMousePressed(int button) will give you one response per click
2  Game Development / Newbie & Debugging Questions / Re: A co-ordinate problem. on: 2012-05-19 13:23:11
well for now just a diagonal line, at the moment a lot of the code is place holder while I get everything together, the issue is the code isn't working properly.

The boomerang is supposed to calculate its path from the centre of the player (I think I know why it doesn't do that) towards the position of the mouse pointer when boomerang.fire() is called.

Remember the formula of the distance traveled by a body (I really don't know how you guys call this, I'm not a native english speaker. I'm talking about accelerated movement in a vertical shot):
 1 `distance = initialSpeed*elapsedTime + (1/2)*gravityAcceleration*(elapsedTime^2)`

From the way I see it, this movement resembles a lot to the one of a boomerang (Only if you throw it with a 90ยบ angle. If you click above the head of the player)
If you already have a way to calculate the angle between the player and the position where the user clicked...

...then I'm pretty sure there is a way to "shift" the trajectory of the boomerang by multiplying it for the sine or cosine of the angle. I'm afraid I can't help you with that because I suck at math, even worse than how I suck at speaking english. But I think someone smarter should have no problem.

I hope I didn't misunderstood the problem and this could actually help.
 3 Game Development / Game Play & Game Design / Re: How can I make this unique? on: 2012-05-03 21:28:48 You should definitely take a look at Jesse Schell's book "The Art of Game Design". In chapter 6 (page 58) he writes about a conversation he had with a juggler at a juggling festival where the man told him he got his inspiration from keeping his eyes open while looking at everywhere else except other jugglers tricks.It's a nice story and I really shouldn't try to describe all of it with my limited knowledge of English (If there's no problem then I could copy the text here, but I don't know if it's allowed) but you should see if you could find it because it might help you find the inspiration you need.
 4 Game Development / Newbie & Debugging Questions / Re: Only one JAR file and a savegame feature. Posible? on: 2012-04-15 17:26:13 Quote from: gouessej on 2012-04-15 08:31:58Using only one JAR file as an "executable" file is a bad ideaI was thinking about using Launch4j and create an .exe file from the .jar (that way I can also create an icon for the app )Ok, so there's no way to implement a savegame feature without creating extra files. Thanks everyone for the code snippets and advices
 5 Discussions / General Discussions / Re: JDX S7100 on: 2012-04-14 03:38:26 Every OS, platform and mobile games supported, except the ones from Microsoft?Obviously they're doing something wrong.
 6 Game Development / Newbie & Debugging Questions / Re: Only one JAR file and a savegame feature. Posible? on: 2012-04-14 02:54:52 But, wouldn't you have to manually delete the game folder after deleting the .jar?  Perhaps I didn't explain very well what my question was (not being a native English speaker doesn't help either). Basically what I'm asking is if there's a way to save the state of a game packaged in an executable .jar without creating any other aditional files. And of course, without uploading the data to a server or something like that.
 7 Game Development / Newbie & Debugging Questions / Only one JAR file and a savegame feature. Posible? on: 2012-04-14 00:46:05 That's what I've been asking myself since I read the criteria for selecting featured games. I'm talking about this, specifically:QuoteInstallation: +1 point if the game installs and uninstalls correctlyI wanted to add achivements to my game (like the ones in PS3/XBox games) and I thought about writing a text file and save the progress of the player and the amount of trophies earned in that file. But the thing is that that file would be created in the same directory as the .jar (or any other folder) and if you wish to delete the .jar then the savegame file will remain there (duh) unless you delete it as well. Then I thought that I could simply create a file or modify an existing one within the .jar, and update it while in game. A quick google search on how to do that made me realize that it was too difficult/impossible to do.I could also use an installer and then the uninstall would take care of the problem of deleting the .jar and the savegame files for the user, but the question remains the same:Is it possible to create a savegame feature in a game deployed trough an executable .jar while not creating extra files for that purpose?Thanks!
 8 Games Center / Archived Projects / Re: Alien Eyes Invasion (W.I.P.) on: 2012-04-12 23:32:53 I like the improved graphics. Looking forward to the playable version!
9  Games Center / Archived Projects / Re: Hell Jumper: Full Armored Linear Lander - LWJGL on: 2012-04-09 12:55:16
When I double click on the file Fall-launcher.jar nothing happens
A window pops up with the label "Fall - By William Starkovich" but it closes immediatly. When I tried to run it from console I get no error message at all.

The level editor (GLFLE.jar) works fine though. I also tried to run the file "fall.jar" in the 'system' folder and I get the following error:
 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21 `starting programjava.io.FileNotFoundException: config.cfg (The system cannot find the file specified)        at java.io.FileInputStream.open(Native Method)        at java.io.FileInputStream.(Unknown Source)        at java.io.FileReader.(Unknown Source)        at cypri.games.glfall.GLFall.loadCFG(GLFall.java:144)        at cypri.games.glfall.GLFall.start(GLFall.java:112)        at cypri.games.glfall.GLFall.main(GLFall.java:378)Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path        at java.lang.ClassLoader.loadLibrary(Unknown Source)        at java.lang.Runtime.loadLibrary0(Unknown Source)        at java.lang.System.loadLibrary(Unknown Source)        at org.lwjgl.Sys\$1.run(Sys.java:73)        at java.security.AccessController.doPrivileged(Native Method)        at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)        at org.lwjgl.Sys.loadLibrary(Sys.java:95)        at org.lwjgl.Sys.(Sys.java:112)        at org.lwjgl.opengl.Display.(Display.java:135)        at cypri.games.glfall.GLFall.createWindow(GLFall.java:902)        at cypri.games.glfall.GLFall.start(GLFall.java:113)        at cypri.games.glfall.GLFall.main(GLFall.java:378)`

I copied the file 'config.cfg' and pasted it inside system, and run 'fall.jar' again:
 1  2  3  4  5  6  7  8  9  10  11  12  13  14 `starting programException in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path        at java.lang.ClassLoader.loadLibrary(Unknown Source)        at java.lang.Runtime.loadLibrary0(Unknown Source)        at java.lang.System.loadLibrary(Unknown Source)        at org.lwjgl.Sys\$1.run(Sys.java:73)        at java.security.AccessController.doPrivileged(Native Method)        at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)        at org.lwjgl.Sys.loadLibrary(Sys.java:95)        at org.lwjgl.Sys.(Sys.java:112)        at org.lwjgl.opengl.Display.(Display.java:135)        at cypri.games.glfall.GLFall.createWindow(GLFall.java:902)        at cypri.games.glfall.GLFall.start(GLFall.java:113)        at cypri.games.glfall.GLFall.main(GLFall.java:378)`

Then I went to system/natives/natives-win and copied everything to the same dir as fall.jar, and run it again:

 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24 `starting programset display modeset full screenenable vsyncset titlecreate displayjava.lang.RuntimeException: Resource not found: data/audio/bgm0.ogg        at org.newdawn.slick.util.ResourceLoader.getResource(ResourceLoader.java:115)        at cypri.games.glfall.Map.(Map.java:21)        at cypri.games.glfall.GLFall.init(GLFall.java:689)        at cypri.games.glfall.GLFall.start(GLFall.java:117)        at cypri.games.glfall.GLFall.main(GLFall.java:378)java.lang.RuntimeException: Resource not found: data/graphics/pixel.png        at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:69)        at cypri.games.glfall.GLFall.init(GLFall.java:699)        at cypri.games.glfall.GLFall.start(GLFall.java:117)        at cypri.games.glfall.GLFall.main(GLFall.java:378)create screen shaderException in thread "main" java.lang.IllegalStateException: Function is not supported        at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:58)        at org.lwjgl.opengl.GL20.glCreateProgram(GL20.java:262)        at cypri.games.glfall.GLFall.initGL(GLFall.java:830)        at cypri.games.glfall.GLFall.start(GLFall.java:123)        at cypri.games.glfall.GLFall.main(GLFall.java:378)`

Then i moved everything to the original folder (where the folders 'system' and 'data' are located) and tried again:

 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 `starting programset display modeset full screenenable vsyncset titlecreate displayMon Apr 09 09:58:27 GFT 2012 INFO:Initialising sounds..Mon Apr 09 09:58:27 GFT 2012 INFO:- Sound worksMon Apr 09 09:58:27 GFT 2012 INFO:- 64 OpenAL source availableMon Apr 09 09:58:27 GFT 2012 INFO:- Sounds source generatedMon Apr 09 09:58:27 GFT 2012 INFO:Use Java PNG Loader = trueMon Apr 09 09:58:27 GFT 2012 WARN:class org.newdawn.slick.opengl.PNGImageData failed to read the datajava.io.IOException: Unsupported bit depth: 16        at org.newdawn.slick.opengl.PNGDecoder.readIHDR(PNGDecoder.java:573)        at org.newdawn.slick.opengl.PNGDecoder.(PNGDecoder.java:116)        at org.newdawn.slick.opengl.PNGImageData.loadImage(PNGImageData.java:81)        at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:62)        at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:43)        at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:292)        at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:254)        at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:200)        at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:64)        at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:24)        at cypri.games.glfall.GLFall.init(GLFall.java:699)        at cypri.games.glfall.GLFall.start(GLFall.java:117)        at cypri.games.glfall.GLFall.main(GLFall.java:378)create screen shaderException in thread "main" java.lang.IllegalStateException: Function is not supported        at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:58)        at org.lwjgl.opengl.GL20.glCreateProgram(GL20.java:262)        at cypri.games.glfall.GLFall.initGL(GLFall.java:830)        at cypri.games.glfall.GLFall.start(GLFall.java:123)        at cypri.games.glfall.GLFall.main(GLFall.java:378)AL lib: ReleaseALC: 1 device not closed`

And then I got tired    No, really I don't know what else to try.
Again, all that came out of 'fall.jar', because 'Fall-launcher.jar' doesn't display any message at all. It just closes as soon as you open it.
I have WinXP 32bits & java v1.7
10  Game Development / Newbie & Debugging Questions / Re: Problems creating jar files. on: 2012-04-02 03:05:14
I try to create an executable jar using export (in eclipse), but the resulting jar doesnยดt run at all.
I did what H3rnst said but still, it doesnยดt run.

Try to run it from console with the following command:
 1 `java -jar your_game.jar`

and it should display some kind of error. Tell us what is it, or do as ra4king says and upload the .jar you're having problems with.
 11 Game Development / Newbie & Debugging Questions / Re: Problems creating jar files. on: 2012-03-31 01:39:08 Quote from: sproingie on 2012-03-30 22:52:46Quote from: H3rnst on 2012-03-30 21:20:49I was also using this in my manifest.txt file. It has to be named MANIFEST.MF and be in a directory called META-INF in the root of your jar.I've never said that!!
 12 Game Development / Newbie & Debugging Questions / Re: Problems creating jar files. on: 2012-03-30 21:20:49 Here's what I do when I want to create an executable jar from a new project:- In the Package Explorer, right click on the project folder.- Run As -> Run Configurations.- On the left of the window, right click on Java Application -> New (After this you should have a subset option below Java Application)- On the right part of the window you should have a 'Search' button next to a 'Main class' label. Click on it and start typing the name of your main class. It should appear in the 'Matching items' list. Click OK.- Click Apply, and Close.- Go back to the Package Explorer, right click on the project folder.- Export -> Java folder -> Runnable JAR file -> next.- In 'Launch configuration' select the launch configuration you've just created.- In 'Export destination' choose where you want the JAR file to be saved.- If you have referenced libraries in your project, click the option "Package required libraries into generated JAR"- Click Finsh.Hope this helps!
 13 Games Center / Showcase / Re: ErnCon on: 2012-03-01 19:48:27 Ok, don't worry. You're doing a great job, keep it up!
 14 Games Center / Showcase / Re: ErnCon on: 2012-03-01 13:28:26 Hey, nice trailer!!  Guess we'll have to wait for a while down here in Argentina to try it
 15 Games Center / Showcase / Re: Lodestar: Stygian Skies on: 2012-02-29 13:45:38 awww look at the trees, they're so cute!!
16  Game Development / Newbie & Debugging Questions / Re: Time interval between movement/shooting on: 2012-02-28 23:36:13
Ok, I think this is probably the crappiest, less cpu-friendly solution ever. I'm still a n00b and this was the first thing that came to my mind:

 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 `//Code...int randomness = 30; //If you increase this number, the enemies will shoot less timesRandom ran = new Random(); //Creates a new random number generator//Code...// Time Interval      if(enemyCount>125)      {          for(int enemys = 0;enemys < enemyContainer.size(); enemys++) // Go throught all enemys          {              if(ran.nextInt(randomness) == 0) //This means that this enemy will not shoot unless the random number equals 0 (or whatever value you want)                  {                 for(int bullets = 0;bullets < 5;bullets++) // Shoot 5 Bullets                 {                     projectile = new Projectile(enemyContainer.get(enemys).x - (bullets*30),enemyContainer.get(enemys).y + 13,sprites.projectile);  // Create new Projectile                     enemyBullets.add(projectile);  // Add the bullet the Container                 }              }          }          enemyCount=0;        }      else enemyCount++;`
 17 Games Center / Featured Games / Re: Pixel Towers - Android Game on: 2012-02-16 15:47:28 great game, I've just put a shortcut on my home screen
 18 Games Center / 4K Game Competition - 2012 / Re: 4Khords on: 2012-02-11 13:12:39 Great game & idea! I didn't find it as difficult as the others said it was. I was able to complete it (I guess. Because it went back to level 1)
19  Game Development / Newbie & Debugging Questions / Re: Loading wav, MP3 and MIDI from INSIDE a .jar file on: 2012-02-10 23:11:05
I'm glad you could fix it!

Since I'm a newbie as well, I'll ask just out of curiosity:
Use a forward slash at the beginning of the String to specify the root of the jar, so as many others have repeatedly posted:
 1 `MidiSystem.getSequence(getClass().getResource("/snm/music/midis/Fighting.mid");`

If he's calling this method from inside the snm.music.midiPlayer package. Shouldn't the following code have to work anyway?
 1 `MidiSystem.getSequence(getClass().getResource("midis/Fighting.mid");`
20  Game Development / Newbie & Debugging Questions / Re: Loading wav, MP3 and MIDI from INSIDE a .jar file on: 2012-02-10 22:36:12
Quote
 1  2  3  4  5 `// This commented out one doesn't give a nullpointer exception, because the path IS right,// but it doesn't play anything...The two underneath it, play the MIDI happily when// executing the .jar file, but only if the .mid is in the same folder.    //private Sequence worldMusic = getSequence(getClass().getResourceAsStream("/snm/music/midiplayer/MainTheme.mid"));`

Just to be sure I'm not reading an empty file, I'd remove the comment and change a little your getSequence(String filename) method:

 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18 `    public Sequence getSequence(String filename) {        //I added this!    File midiFile = new File(filename);    System.out.println(midiFile.lenght());        try {            return MidiSystem.getSequence(midiFile);        }        catch (InvalidMidiDataException ex) {            ex.printStackTrace();            return null;        }        catch (IOException ex) {            ex.printStackTrace();            return null;        }    }`

21  Game Development / Newbie & Debugging Questions / Re: Loading wav, MP3 and MIDI from INSIDE a .jar file on: 2012-02-10 22:09:01
Quote from: Ultroman
Thing is, the MidiSystem.getSequence() takes a String

Are we talking about the same MidiSystem class? I quote the java api:
Quote
javax.sound.midi.MidiSystem

static Sequence   getSequence(File file)
Obtains a MIDI sequence from the specified File.
static Sequence   getSequence(InputStream stream)
Obtains a MIDI sequence from the specified input stream.
static Sequence   getSequence(URL url)
Obtains a MIDI sequence from the specified URL.

I couldn't find any method getSequence(String s). Anyway, I've recently had to deal with a similar problem when creating a .jar. Here's how I handled it:

1. Suppose you have the .java files in a package named org.myApp.main and the files (image & audio) in org.myApp.main.resources (notice it's the same prefix for both, "org.myApp.main").

2. Since you can use an InputStream with getSequence(InputStream stream), I'd try this:
 1  2 `// No '/' before "resources/mySound.midi"Secuence mySound = getSequence(getClass().getResourceAsStream("resources/mySound.midi");`

Good luck!
22  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-10 13:58:09
You tried this:

 1  2  3  4  5  6  7 `public void init(){    Image image;}public void render(Graphics g){    image = new Image(256,256);}`

Or this (this is what I meant)
 1  2  3  4  5  6  7  8  9 `Image image;public void init(){    image = new Image(256,256);}public void render(Graphics g){    image.resizeOrDrawThisImage();}`
 23 Game Development / Newbie & Debugging Questions / Re: Newbie & Debugging Questions - Resources on: 2012-02-10 13:54:46
24  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-10 13:47:54
First of all I'd like to say that I'm a complete newbie. Perhaps that's why I find something odd in the next piece of code:

 1  2  3  4  5  6  7  8  9  10  11  12 `try {    Image image = null;     try {        image = new Image(256,256);    } catch (SlickException se) {se.printStackTrace();}//This is the line I'm talking about. What's the purpose of this?image.getScaledCopy(player.getIcon.getWidth(), player.getIcon.getHeight());Graphics g = image.getGraphics();Image pixel = null;`

You're not setting another Image with the return of getScaledCopy(). Does this method sets 'image' to it's scaled copy?

Anyway I don't think it has something to do with your problem. But I do think that it might be a variable scope problem. Have you tried creating the 'image' outside the method and initializing it inside?

25  Game Development / Newbie & Debugging Questions / Re: ConcurrentModificationException on: 2012-01-20 11:57:56
This is my first post!

I don't understand. From what I see here I'm thinking that you want to empty the boulders list.
 1  2  3 `public void menuInit(){   for (Boulder b : boulders) boulders.remove(b);`

Have you tried the clear() method?
 1  2  3 `public void menuInit(){    boulders.clear();`

 Pages: [1]
 SHC (31 views) 2015-08-01 03:58:20 Jesse (21 views) 2015-07-29 04:35:27 Riven (42 views) 2015-07-27 16:38:00 Riven (23 views) 2015-07-27 15:35:20 Riven (26 views) 2015-07-27 12:26:13 Riven (16 views) 2015-07-27 12:23:39 BurntPizza (38 views) 2015-07-25 00:14:37 BurntPizza (47 views) 2015-07-24 22:06:39 BurntPizza (32 views) 2015-07-24 06:06:53 NoxInc (38 views) 2015-07-22 22:16:53
 theagentd 51x wessles 49x basil_ 34x KaiHH 26x orangepascal 25x Riven 22x ags1 20x mooman219 17x bornander 15x KudoDEV 13x princec 11x CelestialCreator 11x klaus 10x pquiring 10x Jesse 10x Spasi 8x
 List of Learning Resourcesby gouessej2015-07-09 11:29:36How Do I Expand My Game?by bashfrog2015-06-14 11:34:43List of Learning Resources2015-05-31 05:37:30Intersection Methodsby Roquen2015-05-29 08:19:33List of Learning Resources2015-05-05 10:20:32How to: JGO Wikiby Mac702015-02-17 20:56:162D Dynamic Lighting2015-01-01 20:25:42How do I start Java Game Development?by gouessej2014-12-27 19:41:21
 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