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.

Adventures of Chap’n Dale

Adventures of Chap’n Dale our final school project at Sint Lucas Eindhoven. This is a 3D “Silent” third person action game made in Unity3D. This project I created all the code. We had just one 3d artist and someone else was responsible for the storyline and all of the documents.

We had some difficulties with our camera. For our camera movement we used the already provided OrbitCamera script. But on some point we needed to disable this script for a very short time to show our camera shock! Re-enabling the OrbitCamera afterwards made it go buggy. The camera got stuck or just kept rotating. For this I wrote the function below in the code snippet.

AOCD_screenshot2

BillboardFinalAOCD_menu

 

Space Jump EaselJS game

During my internship at De Roode Kikker I wanted to create a game. So we decided to make a small game next to the other projects we had. This game called Space Jump is created with another intern, Jessie Titley. Jessie did all the artwork. The game is created with EasleJS, so it works also on mobile devices that support HTML5 canvas. To play the game click here.

I created a level editor for this game so that I could manually place the blocks to jump on.  From this data I created a JSON file. When you start the game, the level is loaded from that created JSON file and game logic is applied to it.

 Ajax call:

The ajax method I used is shown below in the code snippet. What this does is retrieves from the get_level.php file, that is running on my server, the JSON object data.

I first want to send the server a little JSON object to get the right level data back.

  1. I want to POST this data.
  2. Set the dataType to json.
  3. Adress to the correct file.
  4. Create from the JSON object that is send with it a string using JSON.stringify();
  5. And we do not want to cache this.

 

Space jump menu

Space Jump EaselJS game