Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (523)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
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
1  Game Development / Newbie & Debugging Questions / Re: Iterating through children actors - libgdx on: 2014-11-19 22:19:57
It appears you are only sending the gameOver actor to your disableTouch method, and if that's the case then it wouldn't have access to your other actors to be able to disable touch on them.

Actors are not added to other actors, so your gameOver actor would actually not have child actors. All actors are added to the stage, so you'd want to iterate through the actors that have been added to the stage. Stage has a getActors method that returns an array of all its actors, which you could iterate through.

To detect the gameOver actor you can name all of your actors with the setName method and then in your iterator loop get the name of each actor and compare it to the name of your gameOver actor.
2  Game Development / Newbie & Debugging Questions / Re: Java rendering to android on: 2014-11-17 15:55:43
From looking at your other thread, it appears you want to draw shapes, such as lines, circles, etc, is that correct? If so, there is a ShapeRenderer class in LibGDX:
libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/glutils/ShapeRenderer.html
3  Game Development / Newbie & Debugging Questions / Re: Well i have tried but cant get it to work "Prevented Collision Detection" on: 2014-11-17 15:49:08
How about stopping right next to the wall? Were you able to get that working also?
4  Game Development / Newbie & Debugging Questions / Re: Simple alignment problem with buttons - Libgdx on: 2014-11-17 15:45:19
Awesome! Glad you got it working. Smiley

Also, if you edit your original post and put [SOLVED] (exactly like this including the brackets) at the beginning of your thread title it will put a nifty "solved" icon into the title to let others know that your question was solved and you no longer need help on the problem.
5  Game Development / Newbie & Debugging Questions / Re: Well i have tried but cant get it to work "Prevented Collision Detection" on: 2014-11-16 17:38:52
It's kind of hard to give an example that works specifically in your code since you are doing other things outside of your short snippet.

Elsewhere in your code, you determine whether you are moving left and set the "left" flag, correct? If so, then instead of setting a flag that you are moving left, put the check loop there to see if you can move left and move left if you can.

There maybe a better way to do this but just a quick idea:

Also, I’m not sure what the PlayingState.offset does exactly, so I’m removing it for now just to illustrate the idea. Wink

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
if (***LEFT key press***){
   for (int i = 0; i < speed; i++){
      // CHECK
      if(PlayingState.checkCollision(xpos - 1, ypos + height) || PlayingState.checkCollision(xpos - 1, ypos)){
         break;
      }
      // MOVE
      xpos -= 1;
   }
}
if (***RIGHT key press***){
   for (int i = 0; i < speed; i++){
      // CHECK
      if(PlayingState.checkCollision(xpos + 1, ypos + height) || PlayingState.checkCollision(xpos + 1, ypos)){
         break;
      }
      // MOVE
      xpos += 1;
   }
}


That performs your collision check and if there is no collision it updates the position by one and keeps going until it moves the position by "speed". When there is a collision it breaks out of the loop and doesn't update the position. You would do the same thing for vertical movement.
6  Game Development / Newbie & Debugging Questions / Re: Well i have tried but cant get it to work "Prevented Collision Detection" on: 2014-11-16 16:48:42
The method trollwarrior1 mentioned is too move the player inside the for loop by "1" if that spot is open. So if your speed is 10, and there is a wall "8" away, your player will be able to move by 7 (given that 8 will prevent the player from moving forward) within the loop and when it exits the loop you will be right next to the wall.

From what I gather of your code, it doesn't appear that you update the player's position by "1" each time through the loop. This would explain why you end up at different positions from the wall. So using the previous example, if your speed is 10 and there is a wall 8 away, when you check each position up to 10 and then only set motion to "false" if there there is a wall at any point in that range (which 8 would be) then you will immediately stop moving and remain 8 away from the wall.

I assume you check the "left" flag somewhere else and then update the position according to the flag? If so, then you could remove the flag and update the position right there inside of the loop. Then you could update the position by "1" instead of only being able to update position by the value of speed.
7  Game Development / Newbie & Debugging Questions / Re: Simple alignment problem with buttons - Libgdx on: 2014-11-16 16:05:30
That's interesting. By default tables should be "centered" already, but as I said, I've never worked with windows so there may be something else going on.

Are you creating table rows or anything elsewhere in your code? It kind of looks like there is an empty row above it.

As a wild guess, you could try forcing it to the top:

1  
settingsWindow.getButtonTable().center().top();


Another option maybe bypass the buttonTable and try working directly with the Window table.

1  
2  
3  
4  
settingsWindow.align(Align.center);
settingsWindow.add(toggleMusic).size(100, 100).row();
settingsWindow.add(toggleSound).size(100, 100).row();
settingsWindow.add(quitSettingsButton).size(100, 100).row();


Or another option, try ditching the window option all together and use nested tables for your layout. I'm fairly new to LibGDX myself, but nesting tables seem to be fairly easy to work with.
8  Game Development / Newbie & Debugging Questions / Re: Simple alignment problem with buttons - Libgdx on: 2014-11-15 18:51:34
Hi DavidLasry,

The window class extends table, but it also contains another table inside of it called buttonTable. So there are essentially two different tables.

Here is the source for Window.java:
https://github.com/libgdx/libgdx/blob/19e0a888394eed8b4097a264186a1c8da600ed6b/gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Window.java

By using settingsWindow.add() you add buttons directly to the settingsWindow table and by using settingsWindow.getButtonTable().align() you set the alignment of the buttonTable table.

I have never worked with windows as I simply use basic tables and nest them as needed, but you should be able to add your buttons to the buttonTable like this:

1  
2  
3  
4  
settingsWindow.getButtonTable().align(Align.center);
settingsWindow.getButtonTable().add(toggleMusic).size(100, 100).row();
settingsWindow.getButtonTable().add(toggleSound).size(100, 100).row();
settingsWindow.getButtonTable().add(quitSettingsButton).size(100, 100).row();


Now you will be aligning the same table that you add your buttons too.
9  Game Development / Newbie & Debugging Questions / Re: I'm desperate on: 2014-10-10 16:53:02
Since you are already familiar with Java, then try finding some simple game video tutorials (like pacman) that walk you through the entire process from start to finish and follow along line by line. This will get you familiar with the concepts that go into a game.

From there, start making very small tests where you implement just one aspect of a game at a time.

Some possible examples:
- Create a simple game loop that simply paints a circle.
- Next make the circle move across the screen from one end to the other.
- Next make the circle detect the edge of the screen and send it back the other direction when it hits an edge.
- Then get input from the user and make the circle move with the arrow keys instead of moving on its own.
Etc.

In just that little bit you've covered a game loop, updating, painting, basic collision detection, user input, etc all key components to creating games.

So instead of focusing on the exhausting task of "making a game" (OMG!!! Shocked) you can think about creating smaller individual puzzles for yourself that you have to solve. Focusing on these simpler tasks will also allow you to search for specific topics and find better explanations and tutorials related to what you want to know. For example, searching for "how to move an object with arrow keys in java" will likely provide much more useful results than "how to make a game in java", which is an extremely broad topic.

Finally, once you start working on more complex games, it's a very good idea to keep creating "side-projects" regularly where you work out a particular task in isolation without trying to figure it out inside of your more complex game. Once you know exactly how it works in isolation, then incorporating it into your actual game will be a whole lot easier.
10  Game Development / Newbie & Debugging Questions / Re: LibGDX Loading Audio File on: 2014-10-10 16:04:13
Just a quick update: I was able to read in all the bytes from the wav file with the LibGDX FileHandle and then maneuver through the header bytes to extract just the audio bytes (using the document from standford I posted before). It works perfectly on both desktop and android, so I can now officially mark this problem solved!

Thanks again for all the help everyone! Smiley
11  Game Development / Newbie & Debugging Questions / Re: I'm desperate on: 2014-10-09 08:05:11
First off, as a semi-noobie to this forum myself, let me just say that you can expect to be treated with utmost respect here on this forum! Smiley So you need not worry about hate mail or having people treat you in an uncivilized manner for asking beginner questions. This place is beyond awesome!

Second, as has been mentioned before, you might be better served getting familiar with Java before diving head first into a game. You say you have a hard time following tutorial videos, but maybe you just need to find the right ones?

TheNewBoston on youtube is awesome for beginners because he assumes you know absolutely nothing and then builds from the ground up. Bucky is a little on the goofy side which makes the videos fun. He does have a tendency to mess up typing/spelling (something he constantly jokes about himself), so be weary of that. lol He has lots of videos on Java and some on game dev.
http://www.youtube.com/user/thenewboston/playlists

This is another series of Java videos that is highly recommended here on this forum. He sells courses on his site, but the intro to Java course is totally free:
http://courses.caveofprogramming.com/course/java-for-complete-beginners/

Once you have a good grasp of the core language, then expanding into more complex gaming topics and graphics will be a lot easier.

And finally, when you do get into developing games, it helped me a lot to simply follow along with tutorials showing how to make simple games like pacman. Even though the app I'm working on has absolutely nothing to do with pacman this really helped in understanding gaming concepts like game loops, painting, sprite animation, etc. then you can just keep getting more and more in depth and complex from there.

Hope that helps.
12  Game Development / Newbie & Debugging Questions / Re: LibGDX Loading Audio File on: 2014-10-09 07:33:24
Thanks BurntPizza!

I'm also hoping to support iOS devices (assuming the LibGDX conversion process works well), so am I safe in assuming that a 3rd party library like musicg wouldn't be able to be converted to iOS via LibGDX?

If so, then would it be a good idea to just read the bytes straight from the wav file (since wav files aren't compressed) using a byte reader for files that android also supports (have to look more into this as apparently android doesn't support java.nio.Files either....go figure! Roll Eyes)? This gives a good description of the layout inside the wav file:
https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
13  Game Development / Newbie & Debugging Questions / Re: [SOLVED] LibGDX Loading Audio File on: 2014-10-07 07:22:55
Well....after having it work so fantastically on my desktop I tried running it on my Android phone and it crashed and burned!

After some debugging and then some googling I found that Android does not support Java's AudioInputStream! Grrrrrr! That sucks! Huh

I didn't see any kind of LibGDX equivalent to AudioInputStream, so am I going to have to code this separately for each device (android, iOS, blackberry, ect) using native code or is there something else I can do? Thanks!
14  Game Development / Newbie & Debugging Questions / Re: [SOLVED] LibGDX Loading Audio File on: 2014-10-07 02:04:48
Oh wow...that's interesting. Thanks for the heads up BurntPizza, I definitely won't be using asDoubleBuffer() then. Wink
15  Game Development / Newbie & Debugging Questions / Re: [SOLVED] LibGDX Loading Audio File on: 2014-10-07 01:14:50
Niiiiice that is slick! Smiley Thanks BurntPizza, I will give that a go.

Also, it looks like ByteBuffer also has asDoubleBuffer(), so I may even be able to go directly from the byte buffer to the double buffer and bypass the shorts all together:

ByteBuffer.wrap(data).asDoubleBuffer();
16  Game Development / Newbie & Debugging Questions / Re: LibGDX Loading Audio File on: 2014-10-07 00:59:15
Thanks BurntPizza, that was it! Smiley Divided by Short.MAX_VALUE and it is working perfectly now!

Problem officially solved! Thanks everyone, you all are beyond amazing!! Smiley
17  Game Development / Newbie & Debugging Questions / Re: LibGDX Loading Audio File on: 2014-10-07 00:29:09
Thanks philfrei, bypassing the InputStream and getting a File from the LibGDX FileHandle did the trick. Smiley

One last problem I'm having now is when the file plays it just plays a blast of white noise, so I think I'm converting the data from the wav file incorrectly.

The AudioInputStream reads bytes from file and I'm trying to store that into an array of doubles. To do the conversion, I'm storing two bytes into a ByteBuffer and then getting a short back out since a short is 2 bytes, and then I'm casting that to a double to put into the array...it seems like this should work, but maybe this is the wrong way to convert it?

I've also tried reversing the order of putting the bytes into the ByteBuffer (in case I had them backwards), but no change.

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  
   private void readAudioFile(){
      FileHandle fileHandle = Gdx.files.internal("click.wav");        
      File file = fileHandle.file();
      int byteLength = (int)fileHandle.length();
     
      byte[] audioFileBytes = new byte[byteLength];
      audioFile = new double[(byteLength/2)];
     
      try {
         audioInputStream = AudioSystem.getAudioInputStream(file);
         audioInputStream.read(audioFileBytes);
      } catch (UnsupportedAudioFileException e) { e.printStackTrace(); }
        catch (IOException e) { e.printStackTrace(); }
     
      int j=0;
      for (int i=0; i<audioFileBytes.length;){
         audioFile[j++] = bytesToDouble(audioFileBytes[i++], audioFileBytes[i++]);
      }
   }
   
   public double bytesToDouble(byte firstByte, byte secondByte){
      ByteBuffer bb = ByteBuffer.allocate(2);
      bb.order(ByteOrder.LITTLE_ENDIAN);
      bb.put(firstByte);
      bb.put(secondByte);
      return (double)bb.getShort(0);
   }
18  Game Development / Newbie & Debugging Questions / Re: LibGDX Loading Audio File on: 2014-10-06 00:19:06
Hi kingroka123, thanks for the response.

That method works and it plays the sound file, so the Gdx.files.internal("click.wav") method is indeed working. I thought maybe that was the problem since the handle's status was "null" when I debugged and stepped through the program.

For my program I do need to be able to access the audio data from the wav/mp3 file and store the data in an array. I've looked at the LibGDX audio API but didn't see a way to load an audio file from disk and access the data directly. Currently my program generates its own sounds internally (just simple sine wave tones for testing) and stores them in double[]'s, so now I'm trying to load a file from disk and get it in the same format.

I know I can do that with Java's AudioInputStream, but it doesn't seem to work using the LibGDX file handle. Any ideas?

Thanks again!
19  Game Development / Newbie & Debugging Questions / [SOLVED] LibGDX Loading Audio File on: 2014-10-05 22:10:14
Hi all,

I’m trying to load an audio file and then get the audio data as an array using LibGDX, but it is not able to load the audio file. I’m currently using a wav file (I’d like to be able to use mp3’s as well) which is located in the Android assets folder where I have other files for creating text, buttons, etc. and these all work, so it is only the wav file that isn’t loading.

The wav file format is PCM, 44.1kHz, 16bit, mono, little endian.

Here is all the code I have added so far to see if it would pass the wav file to the AudioInputStream without crashing:

1  
2  
3  
4  
5  
6  
7  
try {
   FileHandle fileHandle = Gdx.files.internal("click.wav");        
   InputStream inputStream = fileHandle.read();
   AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(inputStream);
}
catch (UnsupportedAudioFileException e) { e.printStackTrace(); }
catch (IOException e) { e.printStackTrace(); }


I’ve debugged the program and after the line that should create the FileHandle, the handle’s status is “null”. The Gdx.files.internal() method is what I used to load my files for the graphics and they are working.

When I run the program it crashes on the line:
1  
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(inputStream);


Here is the error message I get:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
java.io.IOException: mark/reset not supported
   at java.io.InputStream.reset(Unknown Source)
   at com.sun.media.sound.SoftMidiAudioFileReader.getAudioInputStream(Unknown Source)
   at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source)
   at com.tekker.audioanimation.SoundFile.readAudioFile(SoundFile.java:61)
   at com.tekker.audioanimation.SoundFile.<init>(SoundFile.java:33)
   at com.tekker.audioanimation.Event.<init>(Event.java:30)
   at com.tekker.audioanimation.AudioAnimation.initArrays(AudioAnimation.java:82)
   at com.tekker.audioanimation.AudioAnimation.create(AudioAnimation.java:67)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)


Any ideas what I'm doing wrong? Thanks!
20  Game Development / Newbie & Debugging Questions / Re: LibGDX Problems Loading Skins on: 2014-09-16 01:54:41
D'oh!!! I knew I had to make sure to save the RAW files, but I guess I botched it somehow and it never occurred to me that I had actually saved them wrong. I re-saved the files and the default uiskin works great now on both desktop and android with the files in the Android "assets" folder. Thanks UprightPath and Grunnt you guys are awesome! Smiley


*** EDIT *** Never mind on the button problem, I just figured out what I was doing wrong trying to load the buttons.

The button pack has to be loaded as a TextureAtlas, not a Skin!

This was wrong:
1  
Skin skin = new Skin(Gdx.files.internal("button.pack"));


This is correct:
1  
2  
TextureAtlas atlas = new TextureAtlas(Gdx.files.internal("button.pack"));
Skin skin = new Skin(atlas);


I think I'm good to go....for now at least! Wink Thanks again for your help!
21  Game Development / Newbie & Debugging Questions / Re: LibGDX Problems Loading Skins on: 2014-09-15 02:24:41
Hi UprightPath, thanks for the reply.

Here is a specific example that doesn't do anything except try to load a skin and it still crashes:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
package com.tekker.animationattempt;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;

public class AnimationAttempt extends ApplicationAdapter {
   Skin skin;
   
   @Override
   public void create () {
      skin = new Skin(Gdx.files.internal("uiskin.json"));
   }
}


With the files inside of the Android project "assets/data" folder, it runs for the desktop version and displays a blank screen as expected...the weird part is that I pointed the desktop version to the Android "assets" folder, not "assets/data". So I'm not actually sure why this works for the desktop version, but it does. However it crashes for the android version.

Here are the errors from the Android LogCat:

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  
09-14 19:00:27.934: E/AndroidRuntime(13801): FATAL EXCEPTION: GLThread 10870
09-14 19:00:27.934: E/AndroidRuntime(13801): Process: com.tekker.animationattempt.android, PID: 13801
09-14 19:00:27.934: E/AndroidRuntime(13801): com.badlogic.gdx.utils.SerializationException: Error reading file: uiskin.json
09-14 19:00:27.934: E/AndroidRuntime(13801):    at com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:96)
09-14 19:00:27.934: E/AndroidRuntime(13801):    at com.badlogic.gdx.scenes.scene2d.ui.Skin.<init>(Skin.java:73)
09-14 19:00:27.934: E/AndroidRuntime(13801):    at com.tekker.animationattempt.AnimationAttempt.create(AnimationAttempt.java:12)
09-14 19:00:27.934: E/AndroidRuntime(13801):    at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:236)
09-14 19:00:27.934: E/AndroidRuntime(13801):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1520)
09-14 19:00:27.934: E/AndroidRuntime(13801):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)
09-14 19:00:27.934: E/AndroidRuntime(13801): Caused by: com.badlogic.gdx.utils.SerializationException: Error reading file: uiskin.json
09-14 19:00:27.934: E/AndroidRuntime(13801):    at com.badlogic.gdx.utils.Json.fromJson(Json.java:662)
09-14 19:00:27.934: E/AndroidRuntime(13801):    at com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:94)
09-14 19:00:27.934: E/AndroidRuntime(13801):    ... 5 more
09-14 19:00:27.934: E/AndroidRuntime(13801): Caused by: com.badlogic.gdx.utils.SerializationException: Error parsing file: uiskin.json
09-14 19:00:27.934: E/AndroidRuntime(13801):    at com.badlogic.gdx.utils.JsonReader.parse(JsonReader.java:77)
09-14 19:00:27.934: E/AndroidRuntime(13801):    at com.badlogic.gdx.utils.Json.fromJson(Json.java:660)
09-14 19:00:27.934: E/AndroidRuntime(13801):    ... 6 more
09-14 19:00:27.934: E/AndroidRuntime(13801): Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error reading file: uiskin.json (Internal)
09-14 19:00:27.934: E/AndroidRuntime(13801):    at com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:77)
09-14 19:00:27.934: E/AndroidRuntime(13801):    at com.badlogic.gdx.files.FileHandle.reader(FileHandle.java:164)
09-14 19:00:27.934: E/AndroidRuntime(13801):    at com.badlogic.gdx.utils.JsonReader.parse(JsonReader.java:75)
09-14 19:00:27.934: E/AndroidRuntime(13801):    ... 7 more
09-14 19:00:27.934: E/AndroidRuntime(13801): Caused by: java.io.FileNotFoundException: uiskin.json
09-14 19:00:27.934: E/AndroidRuntime(13801):    at android.content.res.AssetManager.openAsset(Native Method)
09-14 19:00:27.934: E/AndroidRuntime(13801):    at android.content.res.AssetManager.open(AssetManager.java:316)
09-14 19:00:27.934: E/AndroidRuntime(13801):    at android.content.res.AssetManager.open(AssetManager.java:290)
09-14 19:00:27.934: E/AndroidRuntime(13801):    at com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:75)
09-14 19:00:27.934: E/AndroidRuntime(13801):    ... 9 more


Now if I move all of the files for the uiskin out of the Android "assets/data" folder and place them in just Android "assets" (then refresh the files in Eclipse and do Project->Clean for all projects) I get this error on the desktop version:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Error reading pack file: uiskin.atlas
   at com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData.<init>(TextureAtlas.java:187)
   at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:231)
   at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:226)
   at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:216)
   at com.badlogic.gdx.scenes.scene2d.ui.Skin.<init>(Skin.java:69)
   at com.tekker.animationattempt.AnimationAttempt.create(AnimationAttempt.java:12)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Invalid line: <html lang="en" class="   ">
   at com.badlogic.gdx.graphics.g2d.TextureAtlas.readTuple(TextureAtlas.java:443)
   at com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData.<init>(TextureAtlas.java:115)
   ... 7 more


The Android LogCat gives this error:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
09-14 19:13:54.130: E/AndroidRuntime(16053): FATAL EXCEPTION: GLThread 10990
09-14 19:13:54.130: E/AndroidRuntime(16053): Process: com.tekker.animationattempt.android, PID: 16053
09-14 19:13:54.130: E/AndroidRuntime(16053): com.badlogic.gdx.utils.GdxRuntimeException: Error reading pack file: uiskin.atlas
09-14 19:13:54.130: E/AndroidRuntime(16053):    at com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData.<init>(TextureAtlas.java:187)
09-14 19:13:54.130: E/AndroidRuntime(16053):    at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:231)
09-14 19:13:54.130: E/AndroidRuntime(16053):    at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:226)
09-14 19:13:54.130: E/AndroidRuntime(16053):    at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:216)
09-14 19:13:54.130: E/AndroidRuntime(16053):    at com.badlogic.gdx.scenes.scene2d.ui.Skin.<init>(Skin.java:69)
09-14 19:13:54.130: E/AndroidRuntime(16053):    at com.tekker.animationattempt.AnimationAttempt.create(AnimationAttempt.java:12)
09-14 19:13:54.130: E/AndroidRuntime(16053):    at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:236)
09-14 19:13:54.130: E/AndroidRuntime(16053):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1520)
09-14 19:13:54.130: E/AndroidRuntime(16053):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)
09-14 19:13:54.130: E/AndroidRuntime(16053): Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Invalid line: <html lang="en" class="   ">
09-14 19:13:54.130: E/AndroidRuntime(16053):    at com.badlogic.gdx.graphics.g2d.TextureAtlas.readTuple(TextureAtlas.java:443)
09-14 19:13:54.130: E/AndroidRuntime(16053):    at com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData.<init>(TextureAtlas.java:115)
09-14 19:13:54.130: E/AndroidRuntime(16053):    ... 8 more


I believe the problem I'm having is in the initial directory setup and getting the Gdx.files.internal() method to find my files and not necessarily the actual code itself. I've seen several examples that use the Gdx.files.internal() method but I can't seem to get it to work consistently, so I think there is something else that I'm missing.

Thanks again!
22  Game Development / Newbie & Debugging Questions / [solved] LibGDX Problems Loading Skins on: 2014-09-15 01:04:14
Hi all,

I’m having some issues getting skins to load into my LibGDX program. I was able to get the default program to work that displays the badlogic.jpg image, but everything else I’ve tried to do using skins has been less successful.

I’m new to LibGDX and still learning, but from my understanding all images have to be placed under the Android project and I’ve tried placing files in the Android “assets” folder and I’ve also tried placing them in the “assets/data” folder (saw this mentioned on stackoverflow). In Eclipse I have pointed the desktop application to use the Android assets folder.

When trying to create a label using the uiskin the Android version gives an error on this line when trying to load the uiskin.json, however it does work on the desktop version.
skin = new Skin(Gdx.files.internal("uiskin.json"));

The button.pack I created won’t load on either the desktop or the Android version.
skin2 = new Skin(Gdx.files.internal("button.pack"));

As far as I can tell I have all the files that it needs to load these skins. For the uiskin I downloaded the 5 necessary files (default.fnt, default.png, uiskin.atlas, uiskin.json, and uiskin.png) and for the button I’ve gone through the steps of creating a 9-patch and then the button pack.

I haven’t been able to find anything that really spells out clearly where to put these files and how to load them in yet.

For example, the documentation for the Gdx.files.internal() method states:
“Convenience method that returns a Files.FileType.Internal file handle.”
http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/Files.html#internal-java.lang.String-

And for Files.FileType.Internal file handle:
“Path relative to the asset directory on Android and to the application's root directory on the desktop. On the desktop, if the file is not found, then the classpath is checked. This enables files to be found when using JWS or applets. Internal files are always readonly.”
http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/Files.FileType.html#Internal

This states the path is relative to the “assets” folder, however when I tried putting the default uiskin in the “assets” folder it didn’t load for the desktop, but when I put it in the “assets/data” folder it did load. Android didn’t load at all, whether I had the files in “assets” or in “assets/data”. However, running the default program with the badlogic.jpg image did work with it placed in the “assets” folder for both desktop and Android.

I’ve looked at the documentation and other tutorials, but it’s not coming together just yet. Can anyone break down the process of loading skins a more than the existing documentation? I’d greatly appreciate it, thanks! Smiley
23  Games Center / WIP games, tools & toy projects / Random Chord Progression Generator on: 2014-09-01 22:24:59
This is a project I completed several years ago as my final project in college. It was originally created as a web applet, but given the current problems running Java applets I just spent a little time today and converted it over to an application so I could upload it again.

The Random Chord Progression Generator was designed to be an inspirational tool for songwriting and a practice aid for developing musicianship skills. It provides different modes and settings that cover a wide range of skill levels from complete beginners to advanced musicians.

This chord progression generator is different from the ones that I have seen because it uses music theory to randomly generate 'good' sounding progressions instead of using a set of pre-determined progressions that you choose from or randomly picking chords from a key and putting them together (although there are settings for that too, as well as settings for generating chromatic progressions that don't follow a key at all).

No theory is involved in the addition of the chord extensions however, the extension is simply added at random if one or more of the extension buttons are pressed. So if you have several of the extensions enabled you may get some very strange sounding chords and progressions.

Enjoy! Smiley

Download JAR File:
http://www.java-gaming.org/user-generated-content/members/293272/randomprogressiongenerator.jar

24  Game Development / Newbie & Debugging Questions / Re: Where should a Java noob learn game programming? on: 2014-09-01 17:30:55
I recently found this amazing resource for written tutorials on nearly every programming language imaginable:
http://www.tutorialspoint.com/

For certain languages (like Java) it actually has a built in IDE right into the website so you can type and run the examples as you are working through the tutorials. That is just brilliant IMO! Smiley

And another plus for Bucky's Room (aka The New Boston) Bucky is awesome!
25  Game Development / Newbie & Debugging Questions / LibGDX Eclipse Setup Issues on: 2014-09-01 05:54:56
Hi all,

I'm in the process of moving over to LibGDX (based on several recommendations here) and I'm having some issues getting it setup in Eclipse.

I haven't been able to get it to work yet for android and in the process of trying to figure that out I think I broke the desktop version too... Huh I have no idea how I did it, but I think I deleted the DesktopLauncher setting under "Run" --> "Run Configurations..." because now underneath of "Java Application" it says "New_configuration" instead of "DesktopLauncher". I have tried creating a new LibGDX project with Gradle and I also deleted the entire Eclipse folder (since it doesn't actually install) and unzipped it again....but that setting doesn't come back. Is there anything else I can do to get it back?...I'm at a loss here.

The other problem that I've been trying to fix is Android has several errors in the AndroidLauncher:
* android.os.Handler cannot be resolved.
* com.tekker.guitest.GuiTest cannot be resolved
...and a couple others.

From my understanding it's some kind of issue with the Android SDK. But all of the "fixes" I found weren't working...
Right-click android project --> properties --> Java build path --> Order and export...all of those check boxes were already checked
I also tried downloading the ADT Eclipse plugin, but that didn't fix it either.

I do have the Android SDK installed and I pointed to it when creating the project with Gradle.
I also downloaded Samsung Kies for the USB driver, so I could plug my Galaxy S4 phone in and use it with Eclipse.

Any help in getting these issues resolved would be greatly appreciated. Smiley
26  Game Development / Newbie & Debugging Questions / Re: Game Loop Falling Behind on Slower Machines on: 2014-08-17 01:22:32
Thanks BurntPizza! If there is no significant difference for compatibility with LibGDX, then from searching for IDE comparisons in general (not related to LibGDX) I've seen that Eclipse is more widely used, so I will probably go with that one then. Smiley
27  Game Development / Newbie & Debugging Questions / Re: Game Loop Falling Behind on Slower Machines on: 2014-08-17 01:10:55
gouessej,

So basically, it sounds like LibGDX combines a variety of different existing tools together under "one roof" so to speak and allows them all to be used from a single code base? Is that correct?


Also, one more small question...

Is there a preferred IDE for use with LibGDX? For example, when I asked this question about Codename One on their forum, the developer specifically stated to use NetBeans that they use it and they tended to release more updates for it and it worked better overall with Codename One. Is there a similar preference for LibGDX? I have limited experience with both NetBeans and Eclipse, so I have no real personal preference either way. Which ever one has better LibGDX integration or even has more LibGDX tutorials available...I'll go with that one. Smiley

Thanks again!
28  Game Development / Newbie & Debugging Questions / Re: Game Loop Falling Behind on Slower Machines on: 2014-08-16 23:48:36
BurntPizza,

YES! Scene2D.ui that's the one! Thank you so much.

I guess that's what I need is to find some good tutorials on Java --> LibGDX equivalents. Such as, are you looking for a JButton? Use LibGDX Scene2D.ui Widgets Button instead. Wink

I had no idea LibGDX was so awesome! Thank you SHC, gouessej, and BurntPizza for pointing me in this direction. Smiley
29  Game Development / Newbie & Debugging Questions / Re: Game Loop Falling Behind on Slower Machines on: 2014-08-16 23:33:48
Thanks BurntPizza!

Do you know if there is another place where they list the standard Java libraries that is guaranteed to be supported by LibGDX? The LibGDX API only includes their libraries and doesn't include anything from the standard Java API (which is why I didn't know they actually did support Java standard libraries). I just want to make sure I don't end up mixing things that can't be mixed, like for example you said not to use AWT and Swing, so I want to make sure I'm not doing weird things like trying to use basic containers like JFrames to enclose the LibGDX animations if that is not going to work.

Thanks again! Smiley
30  Game Development / Newbie & Debugging Questions / Re: Game Loop Falling Behind on Slower Machines on: 2014-08-16 23:23:27
BurntPizza,

Wow!!! Shocked I had no idea LibGDX supported the entire Java library otherwise I would have gone this route a lot sooner. Looking at the info you posted, RoboVM is how they convert to iOS? So I assume they have other tools they use to convert the Java library to the other platforms as well since it also supports Android, Blackberry, and HTML5?

I think I'm sold on LibGDX! This sounds amazing. Smiley
Pages: [1] 2 3
 

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

The first screenshot will be displayed as a thumbnail.

SHC (24 views)
2014-11-25 12:00:59

SHC (22 views)
2014-11-25 11:53:45

Norakomi (19 views)
2014-11-25 11:26:43

Gibbo3771 (22 views)
2014-11-24 19:59:16

trollwarrior1 (36 views)
2014-11-22 12:13:56

xFryIx (74 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (41 views)
2014-11-12 21:09:33

kovacsa (67 views)
2014-11-07 19:57: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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!