JavaFX 2.0 mp3 player

In my spare time I played with Java to get the hang of it. So I thought it would be cool to make a mediaplayer with Java, but JavaFX doensn’t support that much codecs so I builded a mp3 player.   PROJECT DISCONTINUED DUE THE LACK OF CODECS.   Intelij idea project available here   TRplayer_design

Fruitninja

Fruitninja clone created with Java. This is a school project. Eventually i got a 9/10 points for this project!

The fruits spawn randomly. For a small fruit you’ll get less points then a big one. Once you destroyed 3 bombs you are game over. In the menu you can submit your score and it will save the file locally using Serializable.

For the Mp3 music files to play I used mp3plugin.jar, this is easy to use and works great.

You can download the eclipse project HERE.

fruitNinja fruitNinja_menu

Java Minesweeper

This Java Minesweeper is my first programming assignment at Avans. Here I needed to build a MineSweeper clone. Because I already have some experience in game programming I could easily make this. For those who don’t understand Minesweeper I will explain how it works.

minesweeper fieldMinesweeper field

Somewhere in the field there are mines, these mines you need to avoid. Because if you hit one you will lose the game. A field contains a number, this number shows how much mines there are in the surrounding fields.

1. To start off click any square, preferably towards the middle. Most Minesweeper players click random squares until a group of squares “opens” up. If 4 or 5 squares opened after your click, it’s time to evaluate the numbers. If only one square opens after your click, find another random square.

2. Based on the opened fields you are going to search for mines. So the top right “1”, in the image above, has one mine in his surrounding fields. But because the “1” below him is not a “2” means that the bottom right field is a mine.

3. Once you found a mine mark it with the right mouse button.

With this technique you collect all the mines. Once you found all those mines the mine field will open and you win the game. If you still don’t understand it please watch the video below.

Minesweeper FieldMinesweeper field

 

This is where the fun begins:

BuildField() gets initialized from the constructor. This is where I iterate threw the whole field. I used a HashMap to store the Field objects. And for the Hash key i used its location such as C1, A3 etc.

I create random Mines based on a X amount of chance, this is something that the player is able to manipulate in the beginning of the game.

When the Hashmap is filled with objects I want to set the values of those fields. This is done by countAdjacentMines(), I iterate once again threw the whole field and set the amount of mines that is surrounding a field.