Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comment
  • views

A Game A Month #1: Update – Nearly finished!

Sign in to follow this  


Hi everyone! I’m back with an update of my first monthy game this year. I have made great progress and it seems like I’m on a good way to finish this game in January.

anim_update2.gifUpdate: Clouds, explosions, health-bar, score

Here is a short summary of the progress:

  • Menu, pause and game over states
  • Player death: By getting shot, collision with enemies and ground
  • Restart handling – reinitializing gameplay
  • Counting score, showing at top-right corner
  • Showing health-bar, decreasing on hit
  • Spawning non-shooting obstacles (clouds)
  • Spawning items: Repair tool
  • Additional “super”-class “GameObject” – For ShootingObjects, Obstacles and Items – for handling movement and collision areas
  • Spawning explosion animation on enemy and player death
  • Background shaking
  • Dynamic player shadow

Gameplay improvements

Press to start!

The game starts with a small menu now. It’s done very simple: At the start the gameplay is initialized, but the spawning of enemies and the updating of the player is deactivated, while the flag “started” in the Gameplay class is set to false. So the background is scrolling, which makes an ingame-feeling in the menu. At the center of the screen a label “Press to start” is shown by the GUIStage class. When the user presses space, the “started“-flag is set to true and the Gameplay.update() method spawns enemies and updates everything.

The pause-state works nearly the same. There is a paused-flag, which is set to true, when the user hits escape. When paused is true, the whole update method does nothing anymore, but the Gameplay.draw() method still renders everything. A label “Pause” is shown by the GUIStage class.

Game Over!

As stated above the player can be killed now. This gameplay mechanic needed a bunch of things to be done. At first, the player can crash with the ground. Therefore a ground shadow was added. It gives the player a feeling of how much space is left between the ground and the spaceship.

Furthermore a collision with an missile decreases the health attribute. To show the health to the player, a health bar is needed. It consists of two images rendered at the same position (Check out GUIStage.java). A border image and a red inner image, which width is set dynamically according to the health.

To make the death more intense, a background-shake has been added and some explosion animations will spawn now. The explosions are spawned, too, when an enemy is being killed. I made this animation some time ago, so it did’t take a lot of time to implement this. Explosions are “SpawnObjects” which have their own pool, and are respawned by the SpawnPool, like enemies or missiles. Read more about the SpawnPool further down in the text.

explosion1.pngThe explosion animation consists of 8 frames.

At the player’s death, the gameover process is triggered. A short time offset of two seconds lets the explosion animations finish and makes the player realize that he just lost. The spawning of new enemies is stopped, the control of the player is deactivated but the background still moves. After these two seconds the “Game Over” label is shown and the player has to press a button again, to restart the game.


Another new feature are items (Item.java). Items are spawning at a fixed interval with an own timer. They are managed by the SpawnPool, too. Currently there is only a heal-item but it is possible to define different types with own animations and effects. Items are surrounded by a bubble, which is an additional sprite rendered above the actual item.

update2_screenshot2_item-1024x601.pngA heal-item in a bubble


To make the game less monotone, I had the spontaneous idea to let some obstacles spawn (Obstacle.java). In the current version, a wave of clouds spawns from time to time, which have to be avoided by the player. Of course, it’s possible to add more types of obstacles later on.

cloud.pngThe cloud with a thunder animation

Level generation

Since there are obstacles now, the generation of the spawn stages was improved. It works as follows: A stage has a fixed time limit (currently 20 seconds). Currently there are just four types of enemies. Every stage spawns another type of enemy. After four stages two types of enemies spawn at the same time for the next four stages. After these eight stages the spawn system begins at the first stage again, but with an decreased spawn interval to spawn more enemies. Check out calcLevel() and spawnObjects() in Gameplay.java.

After every two stages, there spawns an obstacle stage, which pauses the spawning of enemies. The duration of the obstacle stage increases every time a new obstacle stage spawns, so this part of the game becomes also harder with time.

The main part is done!

So for now, all core mechanics and features work fine! This is where the fun part starts: creating and adding more enemies, missiles, items, obstacles, levels and, of course, sounds. Also the GUI and the menu need some polish. Finally, some balancing has to be done to make the game as fun as possible. I’m looking forward to the next update!

To do:

  • More enemies and missile types
  • More items
  • More levels
  • Cosmetics (Menu, GUI)
  • Sounds
  • Balancing
  • …drink more coffee!

For those who are here just for the update: that’s all for now! Come back in a week to play the finished game! Until then, I appreciate every feedback and suggestion in the comments.

For more information about this “A Game A Month”-Project read this post.

Source code

Check out the source code of the current udpate on Github or download it here:

To import it to IntelliJ properly, check out my previous post.

More code!

For those who are interested: Like I stated in my previous post, I will dive deeper into the code in this blogpost. Especially the SpawnPool, which is the most important and helpful component of the game, I guess.

Check out the next page!

View the full article

Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Advertisement
  • Blog Entries

  • Similar Content

    • By RoKabium Games
      We've just released a new Alpha version (0.805) of our game SAMA. Lots of changes in this version, mainly around simplifying the UI and game play. Making the pirate list easier to understand, and adding more upgrades, much much more. If you would like to help out with testing, follow the link below.
    • By hoahong
      Hi guys,
      I get the code from StackOverflow to convert RGB (camera image) to RGBA
      public static unsafe void RGB2RGBA_FastConvert4(int pixelCount, byte[] rgbData, byte[] rgbaData) { if ((pixelCount & 3) != 0) throw new ArgumentException(); fixed (byte* rgbP = &rgbData[0], rgbaP = &rgbaData[0]) { FastConvert4Loop(pixelCount, rgbP, rgbaP); } } static unsafe void FastConvert4Loop(long pixelCount, byte* rgbP, byte* rgbaP) { for (long i = 0, offsetRgb = 0; i < pixelCount; i += 4, offsetRgb += 12) { uint c1 = *(uint*)(rgbP + offsetRgb); uint c2 = *(uint*)(rgbP + offsetRgb + 3); uint c3 = *(uint*)(rgbP + offsetRgb + 6); uint c4 = *(uint*)(rgbP + offsetRgb + 9); ((uint*)rgbaP)[i] = c1 | 0xff000000; ((uint*)rgbaP)[i + 1] = c2 | 0xff000000; ((uint*)rgbaP)[i + 2] = c3 | 0xff000000; ((uint*)rgbaP)[i + 3] = c4 | 0xff000000; } } And Convert RGB to RGBA like this:
      byte[] rgb = new byte[800*600*3]; byte[] rgba = new byte[800*600*4]; RGB2RGBA_FastConvert4(800 * 600, rgb, rgba); But i need to convert RGB TO ARGB too, so anybody can please help me?
    • By lacky
      Hey everyone !!
      My name is Florian, and I'm a solo indie game developer, programmer, and digital artist. I've been working passionately on my very own game for quite some time now, and today marks the day of its announcement via Kickstarter! 
      The game is going to be a a challenging 2D platformer in a lovingly created pixel art world! Experience a packed story full of adventure, dangers and secrets! Exploring this vast world with all its mysteries, as well as challenging platforming gameplay and tough boss battles are the main focus points of the game.
      You can find tons of information on the game, as well as the game's trailer over at the Kickstarter project page!

    • By phil67rpg
      I finally got soil to load a png file. my next step is to animate a sprite using a sprite sheet I am unsure of  how to start. here is my code.
      GLuint textureBrick[8]; GLuint loadTex(const char* texname) { /* load an image file directly as a new OpenGL texture */ GLuint texture = SOIL_load_OGL_texture ( texname, SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y ); return texture; } void init() { textureBrick[0] = loadTex("C:\\Users\\Owner\\Desktop\\img.png"); } void renderScene(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, textureBrick[0]); glBegin(GL_QUADS); glTexCoord2i(0, 0); glVertex2i(10, 10); glTexCoord2i(1, 0); glVertex2i(10, -10); glTexCoord2i(1, 1); glVertex2i(-10, -10); glTexCoord2i(0, 1); glVertex2i(-10, 10); glEnd(); glPopMatrix(); glutSwapBuffers(); glDisable(GL_TEXTURE_2D); }  
    • By RoKabium Games
      It's finally arrived, a new PC to test SAMA on in glorious 4K! Coming in true 'IKEA' style though, I hope all the pieces are there, and we don't have any left over bits at the end! :) #gamedev #indiedev #sama #newpc #4k
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!