Falling Rocks

This was my second game that I made using the LibGDX framework, I originally jumped right into Pong which don’t get me wrong, worked but seemed terrible so I decided to go back to basics and actually do something simple. So here we have it, falling rocks.

You play a cave explorer called Jim, after falling into a trench and upsetting the natural balance of the cave, you soon realise that you have caused a landslide of rocks and gems. Avoid the rocks and collect the gems, don’t let Jim get crushed by too many rocks!

Although this game is getting very little attention, I am aware that it is just a reinvention of the wheel but going back to my first ever game and re-writing it with everything I’ve learned, has helped me learn so much more. As I work on other projects I will continue to add and mess with this so enjoy the updates.

http://s4.postimg.org/xhgl2utm5/screenshot2.png

Controls

A - Move Left
D - Move Right
B - Toggle Background
L - Toggle Difficulty Display
F - Toggle FPS Counter
R - Reset Score ( PERMANENT)
Left Alt - Show/Hide Cursor

Some art for you to look over!


http://s26.postimg.org/d7mm1y151/emerald.png

http://s26.postimg.org/6c2diu6o5/ruby.png

http://s26.postimg.org/htnbo1c1x/sapphire.png


http://s26.postimg.org/biditvlfp/diamond.png

[url=http://postimage.org/]
http://s26.postimg.org/n67kofakl/firstaidkit.png

[/url]
http://s26.postimg.org/ubzbqvjnp/medikit.png

Current Features Playable v1.0.0:

  • Full Box2D Physics and partial lighting
  • Chance based spawn system
  • Simple but informative user interface
  • Collect animation and score count indicator
  • Damage indicator
  • Camera shake
  • 4 Treasures to collect
  • 2 Health pickups
  • Highscore saving
  • 4 Difficulties, 2 unlockable
  • Menus
  • Gameplay music
  • health and gem pickups created using Bxfr

Planned:

  • Sound effects
  • New player sprite set
  • Power ups
  • Buff and Debuff drops(slow you down, speed you up, increase spawn rate, shrink size etc)
  • Game modes(Got 1 planned, way off it though)

Download:

https://bitbucket.org/Gibbo/falling-rocks/downloads

The source code should be visible, new to bitbucket. The code is pretty poor, it was written a month into me learning Java (6 or so month ago) Should look better as I refactor and add the changes.

Extremely simple but already quite nice.
If ‘Jim’ is a cave explorer, you yould add some kind of cave background, it could increase the look a lot.
Oh and why all the gems on death?

The gems on death don’t add anything to your score, was simply a place-holder thing to show the game was over. Looked better than nothing lol.

I was in the process of adding a Game Over screen when I was working on it but stopped for some reason, so gonna polish it.

Cave background would be nice yeah, all the artwork is from opengameart.org. I will probably make my own graphics but time is not exactly in my favour atm with work + college hehe.

Update v0.8.1

No visual changes in game :frowning:

Code changes:

  • Removed a ton of duplicate code
  • Moved code to more appropriate places, e.g make Jim handle his own screen bounds
  • Refactored the update method of the FallingEntity class to be less ugly with less “instanceof” checks
  • Added a little Javadoc, will add more later
  • Added licencing to the classes

Next update I will be moving from LibGDX rectangles to Box2D bodies. Feel free to download, afaik you can download the source, if not let me know. It is free for anyone to use but not distribute.

This update is not so much a new playable version of the game but is is the first version taking the game from basic collisions to having an implemented physics engine.

I have implemented Box2D and now all my entities use it, this adds for a more interesting gameplay when something lands, if the player is hit etc.

Deeper into the code I am still factoring things to make more sense, I have changed various classes and added some new ones to make the code seem less messy, I want to make more use of interfaces as well but my Java API knowledge just can’t seem to find a reason at the moment. I have changed the class Jim to just be called Player for clarity. Others things are being added as well, such as a tier system for balance (I want to add stuff later, like special teasures, healthpacks, other things that can fall and damage you)

Below is a list of things I want to add to the game in the long run:

  • Other pick-ups (healthpack, powerups)
  • Other things to dodge
  • Level layouts would be cool but long way from that
  • More but unrealistic at this stage, so keeping sekret :smiley:

From CHANGELOG
0.9.0 -

Unplayable (no player) - STABLE

New

  • Started keeping track of versions
  • Implemeted Box2D Physics engine
  • Added propery boundary, we now have walls
  • Added filtered collisions, Rocks collide with nothing but the Player, Gems collide with Gems + Boundary etc etc
  • Slow down world simulation with UP and speed up with Down (good for testing for collison inaccuracies, which I know are present)

Changes

  • Refactored how entities are spawned, I can sorta fine tune it a little better now for balance
  • New rock textures, now have 5 different rocks with own box2d shapes (These are technicaly changes, but new at the same time. Changes extends New, implements Awsomeness)
  • New gem textures, each Gem now has a higher resolution texture to match the new rock textures

Download -
https://bitbucket.org/Gibbo/falling-rocks/downloads

A playable update!!

Added Jim back into the game, still working on a new set of sprites for him so you will have to good looking at that one for a while :D.

Rocks damage you on first contact, from all angles. Gems get picked up by walking into them (nothing fancy atm, simply disappear).

Hope you enjoy :slight_smile:

Here is the change log:

From CHANGELOG
0.9.1 -

Playable

NEW

  • Added 4 difficulties to the game, Easy, Normal, Hard and Impossibru. Use 1-4 to change difficulty dynamically in-game (will add proper functionality later)
    Easy - Spawn time is doubled, chance of gems is doubled
    (Default) Normal - Spawn time is normal, chance of gems is normal
    Hard - Spawn time is 1.25x faster, chance of gems is reduced by 1.25x
    Impossibru - Spawn time is 2x faster, chance of gems is halved

  • The player now uses Box2D body and Dermetfans AnimatedBox2DSprite class

CHANGES

  • Refactored the Player class to have a proper state system
  • Refactored the entity heirarchy, everything is now an entity within its own category (Collectible, Dangerous etc)

FIXES

  • Changed the way you control the character, will no longer get stuck when pressing one rapidly after the other
  • Game no longer crashes if 2 or more rocks overlap and go past the bottom boundary

Download -
https://bitbucket.org/Gibbo/falling-rocks/downloads#download-302435

Big update :smiley:

Been messing around quite a bit for the last few days, learnt a lot and got some nice reusable code snippets!

This version is playable and imo, it looks considerably more polished that what I initially expected. Would appreciate some feed back, negative or positive, bugs etc.

Feel free to post high scores as well lol.

I will update the OP with the current features and a non shit screenshot.

From CHANGELOG
0.9.2 -

Playable

New

[list]

  • Implemented Box2DLights, it looks a bit more natural now that rocks come from darkness above
  • Added a Glowstick to the game (for future game-mode)
  • Added 2 new pickups to the game, First Aid Kit(+25), Medi-Kit(+100)
  • Added pick up animation, entities now float when walked over and fade out
  • Added score/damage/healing indicators
  • Added a health percentage on the healthbar
  • Added a background image, will add more to it later (those ejyption markings or something) B to disable (for whatever reason)
  • Added a death transition, for now it just fades the lighting out and the player accends to the heavens. Then a new game is automatically started
  • Added FPS counter, toggle with F (Default - Off)
  • Added difficulty display, toggle with L (Default - On)
  • Cursor is now locked to the screen, press Alt to release it
  • Added camera shake when hit with rock
  • Reset highscore by pressing R, temporary placement until I implement menus

Changes

  • Changed the font to look more “snazzy”
  • Gems/rock now have a variable size, their value is now determined using the following forumula: value = (value/dmg * size) * difficulty
  • Refactored the entire spawn code, it is more efficient and adaptable now
  • Items no longer lie on the ground indefinetly, they eventually expire
  • Balanced values to math new spawn rates, still needs work
  • Added camera shake when hit with rock

Fixes

  • Rocks should now collide with the side of the player and not just the head

Bugs

  • If a rock hits the player hard enough, it ends up stuck on his head like a hat
  • Sometimes the player will collide with a gem, resulting in you kicking it half way across the screen (no idea whats up with that)

Check OP for download link and commit

If you want more feedback, you could post more images of your progress. Very few people would actually enjoy plowing through changelogs.

Yeah I wanted to add images of the art I created for it but did not want to spam the thread with loads of pictures hehe. I will make the next update more “visual”.

I think the game is pretty much ready for version 1.0.0 now! Officially beta, the point of no return. I think from here, anything I add to it will be purely for shits and giggles. It has been fun and all but I think I will be working on some of my other project ideas, use this for a code dump and reference, it has taught me so much! :D.

What have I added?

NEW MENUS

http://s26.postimg.org/qsxnd2iq1/Main_Menu.png

http://s26.postimg.org/e2tezzart/Difficulty_Select.png

http://s26.postimg.org/f6djbxvex/Highscore.png

Well yeah, new menus…that’s great and all but I even took the time to self record some sounds, now when poor Jim gets whacked with rock he makes a rather odd grunting noise.

Added some 8bit pickup sounds as well, for some reason.

Oh, there is music, not composed by me of course but from open game art.

Did I mention I implemented touch controls and performance tuned it for android? It could be on the market in the near future. (Really need to replace that stupid player sprite)

Here is a proper list, from the change log:

1.0.0

Playable - Stable

NEW

  • Added a main menu
  • Added a difficulty select menu
  • Added after death menu
  • Touch screen controls implemented for android
  • Click sound effects for menus
  • Gem and health pack pickup sounds using Bfxr
  • Rock impact and player damage sounds (recorded by my awesome microphone)
  • Added a music track during gameplay
  • More I can’t really remember :frowning:

CHANGES

  • Balanced difficulties slightly, the jump from easy to normal was enormous
  • Refactored asset code, the game now runs MUCH more efficiently (Solid 60fps on 4 different android devices of different hardware capabilities)
  • Removed dynamic difficulty changing during gameplay
  • God mode now requires some super sekret key combination
  • Removed Box2D debug mode

FIXES

  • Rocks will now properly be deleted after passing the bottom of the screen
  • Player will no longer collide with gems and health packs while ascending to heaven after death

BUGS

  • If a rock hits the player hard enough, it ends up stuck on his head like a hat, funny but very annoying
  • Sometimes the player will collide with a gem, resulting in you kicking it half way across the screen (no idea whats up with that)