Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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 White Rectangle instead image!? on: 2014-11-30 20:31:06
Looking here at the docs, it says that all resource loading should be done in the init method. Since you were loading the images from the enter method, that's where it was going wrong.

http://slick.ninjacave.com/javadoc/org/newdawn/slick/state/GameState.html#enter(org.newdawn.slick.GameContainer, org.newdawn.slick.state.StateBasedGame)
2  Games Center / WIP games, tools & toy projects / Re: SJGL (Now on GitHub!) on: 2014-11-27 22:03:50
Just letting you know, the pills spawn outside of the little area.


3  Game Development / Newbie & Debugging Questions / Re: LibGDX ClassCastException on: 2014-11-22 20:11:53
I think that the level properties might automatically be set to be strings, so perhaps try making it
1  
Float.parseFloat(getLevel.getProperties().get("player spawn x"))
and the same thing for y;
4  Game Development / Newbie & Debugging Questions / Re: Saving only one value in preferences file - libgdx on: 2014-11-21 02:27:36
Just a little confused. Do you have sound and music stored in your preferences?  When the player turns the music/sound on or off, do you directly change the value you already have stored in the preferences? Thanks Smiley
5  Game Development / Game Play & Game Design / Re: Options menu? (2D games) on: 2014-11-03 03:46:40
If you didn't already know, LibGDX has a UI library built in: scene2d. It's pretty easy to use to add buttons, sliders, and more.

For managing different platforms, there are many different ways you can do it such as having a different option screen class for each platform, so my next idea is just one option of many. So you'll probably have a screen class called Options. When you show the options screen, you would do a check to see what platform the game is on with the method Gdx.app.getApplicationType() or whatever the method is.  Then you could have separate methods for creating the options screen for each platform, so: initDesktopOptions() and initAndroidOptions(). Then you could create the UI elements for each type in each of those methods.
6  Games Center / Featured Games / Re: [Slick2d] Retro-Pixel Castles > GREENLIT! WOooOOOoooOooOoo! < on: 2014-10-10 13:40:49
Awesome! Congrats Cheesy
7  Game Development / Newbie & Debugging Questions / Re: Box2D Circle works but not pentagon Polygon? on: 2014-10-09 13:07:41
Correct me if I'm wrong but doesn't Math.sin use radians? Instead of doing Math.sin(i * 72) would Math.sin(Math.toRadians(i * 72)) work?
8  Games Center / Contests / Re: Ludum Dare 30 (Connected Worlds) on: 2014-08-25 22:34:24
You linked the screen shot, not the game itself! And with a name like 'Dragon' how do you expect us to find you!? We want to play!
Oh gosh I didn't realize I posted a screenshot and not the actual link  Clueless  . Alright here it is. I will also update my original post http://www.ludumdare.com/compo/ludum-dare-30/?action=preview&uid=25675
9  Games Center / Contests / Re: Ludum Dare 30 (Connected Worlds) on: 2014-08-25 01:17:43
Going to play all of your games  Wink

I finished my entry as well:
http://www.ludumdare.com/compo/ludum-dare-30/?action=preview&uid=25675
I know I did better than last Ludum Dare with everything and had a lot of fun this time around!
10  Games Center / WIP games, tools & toy projects / Re: Real Turn - Android RPG with roguelike elements on: 2014-08-19 17:44:12
Looks really cool  Grin . I wish I had an Android device, but I'll just try it on my computer later.
11  Game Development / Newbie & Debugging Questions / Re: Libgdx, Box2D and a huge "block world" (destructible blocks!) on: 2014-08-19 02:16:49
So you call the drawmap method in the render class, so every frame. Any reason why you are creating a fixture every time?
12  Game Development / Newbie & Debugging Questions / Re: Libgdx Death animation on: 2014-08-04 14:56:20
Try doing this after you create the animation.
1  
deathAnimation.setPlayMode(PlayMode.NORMAL);


I'm not sure if this will draw the last frame once it's done. If it does, great, but if it doesn't, you could check to see if it's finished and then do what you want.
1  
deathAnimation.isAnimationFinished(stateTime);
13  Game Development / Newbie & Debugging Questions / Re: (LibGDX) Colorize grayscale sprite on: 2014-07-30 11:45:43
If you are using the Libgdx Sprite class, you can use the sprite.setColor method, just make sure you're rendering your sprite with the sprite.draw method.
14  Game Development / Newbie & Debugging Questions / [LibGDX]Box2dLights Rendering Issue on: 2014-01-14 04:25:20
Hiya,
So, I have a map like this:


Sometime I'm going to add in some stuff and I would like to add in some lights. I took a look at Box2dLights and set it up and it works great (Nice and simple), however I'm not able to do what I want to do. I would like to add in lights that will not affect the lighting anywhere on the scene except where the light is and where it extends to.

I tried moving the RayHandler updateAndRender method around my render method to try different rendering positions, but it didn't do anything to help with my problem. When I put it so that it renders the light after my player and map render methods, it looks good, but where the light it is the only place where there is light. Everywhere else is completely black, but I think that is how the light is supposed to work (not sure).

Sorry if this post was confusing at all. Let me know if you need any more information or if you would like me to restate something.

Thanks!
15  Game Development / Newbie & Debugging Questions / Re: Why isn't drawing a Sprite working? on: 2013-08-19 18:33:52
I played around with it for a little bit, and I found the issue, but didn't solve it.

Pretty much, the main game class sets the screen to MainMenu. MainMenu then runs its show method once then never runs its render method, and switches back to the main game class render method. Why is it doing this?

 I have no idea what to do here because I've tried copying and pasting code from another screen class I made for a different project, pasting it in, then changing all the names and everything, and it still doesn't work.

EDIT: I figured out the issue. I had to add super.render(); to the main game class. Ugh, I can't believe I forgot that, and was trying to figure out the problem for a couple hours now DX. I guess that's programming though Wink
16  Game Development / Newbie & Debugging Questions / Why isn't drawing a Sprite working? on: 2013-08-19 17:48:28
Hi everyone. I'm having an issue, and it's really frustrating because of how simple it is Tongue . Drawing a Sprite isn't working at all. I'm using LibGDX.

For example, with this code, when I draw the sprite, it is flashing really fast.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
@Override
   public void show() {
      batch = new SpriteBatch();

      texture = new Texture("ui/mainmenu.png");
      mainMenu = new Sprite(texture);
      mainMenu.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
     
      batch.begin();
      mainMenu.draw(batch);
      batch.end();
   }

   @Override
   public void render(float delta) {
      Gdx.gl.glClearColor(0, 0, 0, 1);
       Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
   }


but with this code, my sprite doesn't show up at all.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
   @Override
   public void show() {
      batch = new SpriteBatch();

      texture = new Texture("ui/mainmenu.png");
      mainMenu = new Sprite(texture);
      mainMenu.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
   }

   @Override
   public void render(float delta) {
      Gdx.gl.glClearColor(0, 0, 0, 1);
       Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
       
       batch.begin();
       mainMenu.draw(batch);
       batch.end();
   }


Thanks in advance Smiley
17  Game Development / Newbie & Debugging Questions / Re: Error When Loading TileMap - NumberFormatException on: 2013-06-18 22:30:10
I'll take a look at that. Thank you!
18  Game Development / Newbie & Debugging Questions / Error When Loading TileMap - NumberFormatException on: 2013-06-18 21:01:19
Hello!
I've been playing around and learning Slick2d lately, and I decided to do a Tile Map. However, when I try and load it, it gives me an error. First, this is the error:
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  
35  
36  
37  
38  
39  
40  
Tue Jun 18 14:58:40 MDT 2013 INFO:Slick Build #237
Tue Jun 18 14:58:40 MDT 2013 INFO:LWJGL Version: 2.9.0
Tue Jun 18 14:58:40 MDT 2013 INFO:OriginalDisplayMode: 1440 x 900 x 32 @60Hz
Tue Jun 18 14:58:40 MDT 2013 INFO:TargetDisplayMode: 960 x 600 x 0 @0Hz
Tue Jun 18 14:58:40 MDT 2013 INFO:Starting display 960x600
Tue Jun 18 14:58:40 MDT 2013 INFO:Use Java PNG Loader = true
Tue Jun 18 14:58:40 MDT 2013 INFO:Controllers not available
Tue Jun 18 14:58:40 MDT 2013 ERROR:For input string: ""
java.lang.NumberFormatException: For input string: ""
   at java.lang.NumberFormatException.forInputString(Unknown Source)
   at java.lang.Integer.parseInt(Unknown Source)
   at java.lang.Integer.parseInt(Unknown Source)
   at org.newdawn.slick.tiled.TiledMap$GroupObject.<init>(TiledMap.java:1079)
   at org.newdawn.slick.tiled.TiledMap$ObjectGroup.<init>(TiledMap.java:1033)
   at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:688)
   at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:106)
   at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:90)
   at com.dragon.Level1.init(Level1.java:21)
   at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
   at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
   at com.dragon.Main.main(Main.java:29)
Tue Jun 18 14:58:40 MDT 2013 ERROR:Failed to parse tilemap
org.newdawn.slick.SlickException: Failed to parse tilemap
   at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:695)
   at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:106)
   at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:90)
   at com.dragon.Level1.init(Level1.java:21)
   at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
   at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
   at com.dragon.Main.main(Main.java:29)
Caused by: java.lang.NumberFormatException: For input string: ""
   at java.lang.NumberFormatException.forInputString(Unknown Source)
   at java.lang.Integer.parseInt(Unknown Source)
   at java.lang.Integer.parseInt(Unknown Source)
   at org.newdawn.slick.tiled.TiledMap$GroupObject.<init>(TiledMap.java:1079)
   at org.newdawn.slick.tiled.TiledMap$ObjectGroup.<init>(TiledMap.java:1033)
   at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:688)
   ... 7 more


Here is the class that is causing the problem:
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  
35  
36  
37  
38  
39  
package com.dragon;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
import org.newdawn.slick.tiled.TiledMap;

public class Level1 extends BasicGameState {
   int stateID  = 4;
   
   private TiledMap map;
   
   public Level1(int state) {
      stateID = state;
   }

   @Override
   public void init(GameContainer container, StateBasedGame game) throws SlickException {
      map = new TiledMap("/res/world/level.tmx"); //Error
   }

   @Override
   public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException {

   }

   @Override
   public void update(GameContainer container, StateBasedGame game, int delta)   throws SlickException {
     
   }

   @Override
   public int getID() {
      return stateID;
   }

}


I know that it's the map = new TiledMap... line that's causing this because of the error message. When I comment that line out, the game works fine. Thanks!
19  Game Development / Newbie & Debugging Questions / Re: Where to go From Where I'm at? on: 2013-05-14 01:48:34
Cool, thank you  Grin
20  Game Development / Newbie & Debugging Questions / Where to go From Where I'm at? on: 2013-05-14 01:29:00
Hello. So, I've learned the basics/intermediate of java, and would like to start game developing. I've downloaded and setup LibGDX, but now I'm not sure where to go from here. Are there any resources that you have to start with LibGDX? Thanks!
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.

rwatson462 (30 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (50 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (45 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (57 views)
2014-11-29 21:32:03

toopeicgaming1999 (123 views)
2014-11-26 15:22:04

toopeicgaming1999 (113 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26: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
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!