Java Programming: The health system and changing levels!

Hey, I am back again, and it’s been a busy week or two in Java for me! I’ve done a bit of optimising of the player rendering, and I’ve added a few more tiles, but the standout features in this new update are the new health system, which is almost fully implemented, and the ability to change between levels by standing on a ‘warp’ block! I have also started to add an experience system, but this is barely implemented yet, so take no notice of that. The changelist for this update is:

  • Almost fully-implemented health system. The health of the player cannot exceed 100 and if it reaches 0, the game will cease to continue and “You died!” is displayed on the screen.
  • The new Spikes tile will harm you on 1/60 ticks (once a second)
  • The lava tile will now harm the player at an extremely fast rate
  • Lava will now set the player on fire. The player will continue to be on fire after exiting the lava for a short while. Entering water or a heal tile (new in this update) will extinguish the fire.
  • The new heal tile simply heals any player stood on it.
  • A new marble tile, the texture of which is temporary, is currently a solid tile and is purely decorative.
  • Swimming in water too long (10 seconds) will cause you to run out of air and start taking damage to imitate drowning.
  • New level warp tile. When you stand on this tile, it will transport you to a new level, and you will keep all of your health (and experience) you have obtained. The level you warp to is currently linear, in that it is coded straight into the source code, and no user input can change the target level. In the future, these tiles will be positioned on the edge of the map for linear gameplay, similar to the original Legend of Zelda, and a new tile will be added for user-controlled warping, for sandbox gameplay.
  • The game icon is now a little version of the player (aww, cute!)
  • The number of frames and ticks the game is currently running at are displayed in the game’s title.

Now you know what’s been changed, screenshot time!Image

This shows the new game screen, with the (out of date, sorry) version number at the bottom and the health counter at the top; this will eventually be changed into a more graphical display. The purple tiles near the player are the new warp tiles, just walk on these and in an instant, this happens:

Image

…and as if by magic, the player is transported to the next level! The health stays the same across levels. The warp tiles for this level are in the top-left corner, but within the n-shaped marble structure you can see are some heal tiles. Standing on them causes the player to turn purple for a short while and will heal 5% health every second. There is also a singular heal tile to the left of this.

[EDIT:] I can’t believe I forgot about the dark grey tiles on the left! Silly me. They are spike tiles, and they hurt the player when they walk on it.

Image

The counter below the health shows the player’s air while swimming, when it reaches 0 it displays “No air!” in red and the player will start being hurt.

Image

This shows the death screen, which will be much improved in the future, as well as the player in lava and on fire (shows the effect that the player turns red while hurt also). At this point, the game will continue to render and tick but the player cannot move due to the input being disabled.

That’s that for today’s update, sometime in the future I hope to put out an early test release for this game so that you can try it out and give feedback on bugs, features you would like etc. but this will only happen when this turns into an actual game, right now all you can do is move about really, but considering this is my first game, it’s going very well! Some features I will attempt to add soon are items, more entities (such as mob spawners, maybe arrows) and therefore more mobs, perhaps some hostile ones, and more levels with some linear gameplay. Also coming soon (maybe), I will review a few random games I got my hands on recently, including some really old favourites of mine, as well as some new games I’ve never played before. I will probably review around 10 games, depending on the time I have available. As always, thanks for reading and stick around for more soon.

-Daniel

Advertisements