Falling Pots

Falling Pots

Download: http://dl.dropbox.com/u/70454565/Falling%20Pots.rar

This is a game I made in a couple of hours (still pretty noob lol) to test LibGDX (just started learning). It’s pretty bad in terms of being polished. File size is probably a little too large.

Objective - prevent the monsters from crossing the bottom of the screen and collect enough pots (Potions) to max all your stats!

Controls - Left/Right arrow keys to move, space to fire, move to a falling pot to collect it.

to max your stats you need…
4 speed pots (green)
4 dexterity pots (orange)
10 defense pots (black)
3 life pots (cyan)
3 mana pots (yellow)
2 attack pots (pink/purple)
2 wisdom pots (blue)
2 vitality pots (red)

All sprites copied from Realm of the Mad God (awesome game btw, too addicting), all sounds/music from freesound.org.

I really like the outlined art style… I think I’ll write a somehow “cool” version of this… I have a pretty fun Idea in my mind… hehe… Yeah…

offtowork
tomorrow,causeI’llgotosleepnow…

I thought those looked familiar haha. Keep up the good work and definitely ask questions constantly; these guys love solving problems!

Kept getting:

and also:


Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.IndexOutOfBoundsException: 2
        at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:107)
Caused by: java.lang.IndexOutOfBoundsException: 2
        at com.badlogic.gdx.utils.Array.get(Array.java:125)
        at com.game.MyGame.render(MyGame.java:155)
        at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:181)
        at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:104)
Press any key to continue . . .

2 of the characters kept showing up too, could just be my poor computer ;).
Besides that looks nice.

Huh. OpenGL version 2.0 supported?
What OS?

The game runs for a little bit, the exception happens during holding down the space bar :wink:
Windows 7 HP
Not Responding is probably due to my slow computer :cranky:

@Jimmt, have you tried checking what could be causing this exception at line 155 of your MyGame class?

Yeah, it’s just batch.draw(enemies.get(i).image, enemies.get(i).x, enemies.get(i).y); in a for loop that iterates through enemies.size times.
I honestly don’t care that much about this game lol, just want to get working on my next game ;D

So ‘i’ got out of bounds :stuck_out_tongue:

Either way, it’s best you do :stuck_out_tongue:

I have a game engine built on top of the predecessor to libgdx… In my experience, an index out of bounds error while batching items to the screen can usually be fixed with one of the following:

  1. Making sure there are items to be drawn before starting a batch
    for example
    if(enemys.size() > 0){
    beginbatch(enemyTex);
    //loop and draw
    endbatch()
    }

or

  1. The batchers buffer is too small and there are too many sprites to draw within the buffer, so increase the buffer size
    for my sprite batcher the buffer size is denoted in the constructor
    SpriteBatcher batcher = new SpriteBatcher(gl instance, bufferSize);

Hope this helps…