Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
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: [Slick2d] [input] Keys and mouse firing too fast on: 2012-06-13 04: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 15: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 23: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 19:26:13
Using only one JAR file as an "executable" file is a bad idea

I was thinking about using Launch4j and create an .exe file from the .jar (that way I can also create an icon for the app Tongue )

Ok, so there's no way to implement a savegame feature without creating extra files. Thanks everyone for the code snippets and advices  Grin
5  Discussions / General Discussions / Re: JDX S7100 on: 2012-04-14 05: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 04:54:52
But, wouldn't you have to manually delete the game folder after deleting the .jar?  Huh

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 02: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:
Quote
Installation: +1 point if the game installs and uninstalls correctly

I 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-13 01:32:53
I like the improved graphics. Looking forward to the playable version! Cheesy
9  Games Center / Archived Projects / Re: Hell Jumper: Full Armored Linear Lander - LWJGL on: 2012-04-09 14:55:16
When I double click on the file Fall-launcher.jar nothing happens Sad
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 program
java.io.FileNotFoundException: config.cfg (The system cannot find the file specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at java.io.FileReader.<init>(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.<clinit>(Sys.java:112)
        at org.lwjgl.opengl.Display.<clinit>(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 program
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.<clinit>(Sys.java:112)
        at org.lwjgl.opengl.Display.<clinit>(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 program
set display mode
set full screen
enable vsync
set title
create display
java.lang.RuntimeException: Resource not found: data/audio/bgm0.ogg
        at org.newdawn.slick.util.ResourceLoader.getResource(ResourceLoader.java:115)
        at cypri.games.glfall.Map.<init>(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 shader
Exception 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 program
set display mode
set full screen
enable vsync
set title
create display
Mon Apr 09 09:58:27 GFT 2012 INFO:Initialising sounds..
Mon Apr 09 09:58:27 GFT 2012 INFO:- Sound works
Mon Apr 09 09:58:27 GFT 2012 INFO:- 64 OpenAL source available
Mon Apr 09 09:58:27 GFT 2012 INFO:- Sounds source generated
Mon Apr 09 09:58:27 GFT 2012 INFO:Use Java PNG Loader = true
Mon Apr 09 09:58:27 GFT 2012 WARN:class org.newdawn.slick.opengl.PNGImageData failed to read the data
java.io.IOException: Unsupported bit depth: 16
        at org.newdawn.slick.opengl.PNGDecoder.readIHDR(PNGDecoder.java:573)
        at org.newdawn.slick.opengl.PNGDecoder.<init>(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 shader
Exception 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  Grin  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 05: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 03:39:08
I 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!!  Huh Grin
12  Game Development / Newbie & Debugging Questions / Re: Problems creating jar files. on: 2012-03-30 23: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 20:48:27
Ok, don't worry. You're doing a great job, keep it up!  Cheesy
14  Games Center / Showcase / Re: ErnCon on: 2012-03-01 14:28:26
Hey, nice trailer!!  Grin

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 14:45:38
awww look at the trees, they're so cute!!  Grin
16  Game Development / Newbie & Debugging Questions / Re: Time interval between movement/shooting on: 2012-02-29 00: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 times

Random 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 16:47:28
great game, I've just put a shortcut on my home screen  Grin
18  Games Center / 4K Game Competition - 2012 / Re: 4Khords on: 2012-02-11 14: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-11 00:11:05
I'm glad you could fix it!  Grin

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 23: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 23: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 14: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 14:54:46
Newbie-friendly way to set up Eclipse with Slick2D and LWJGL

Recursive resources!

24  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-10 14: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 12: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]
 

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

The first screenshot will be displayed as a thumbnail.

Riven (19 views)
2014-07-29 18:09:19

Riven (13 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (31 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (42 views)
2014-07-24 01:59:36

Riven (42 views)
2014-07-23 21:16:32

Riven (28 views)
2014-07-23 21:07:15

Riven (29 views)
2014-07-23 20:56:16

ctomni231 (60 views)
2014-07-18 06:55:21
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!