Showing posts with label Game Programming. Show all posts
Showing posts with label Game Programming. Show all posts

Tuesday, January 13, 2015

Mastermind

I quite like JavaScript and wanted to know a little more about drag and drop so I decided to make an online version of Mastermind.

Visual Studio makes it easier to write JavaScript.  It has good IntelliSense and you can quickly locate your functions and variables. You can also debug the JavaScript by stepping through the code line by line.

In the game, you can drag the pieces from anywhere.  For instance you can take a piece from the row below and drag it up.

The game can be played here: mastermind.azurewebsites.net.

If you are curious about the JavaScript then you can download it from here and save it to your computer.  (You may get security warnings).

Rinus

Tuesday, October 14, 2014

HTML 5 and javascript game programming.

pac.azurewebsites.net


I want to get better at javascript and I still think that the best way to learn something new is to just dive in and start using it.

Only when you actually try and create something do you realize what you know, wish you knew, or thought you knew but don't.

So the challenge was to create a Pacman game.  I wanted to make something fairly close to the original.  For instance I knew that each ghost had its own movment pattern but I did not know what it was.  I found this great site that explains the rules of the ghost behavior: Understanding ghost behavior

So the ghost behavior made it into the game.

Other features are:
  • Just like the original, the ghosts will attack in waves and then back off and then attack again.
  • When you eat a ghost, the eyes zoom back to the home base.
  • Pacman can outrun the ghost because it can take corners quicker than the ghosts.
  • If you stay too long on a level, then the red ghost will become quite fast. Don't hang around too long.
  • And also - there is also a high score table!
So what are you waiting for? Have a go at: http://pac.azurewebsites.net

Friday, July 5, 2013

iPod game programming.

Two of my kids bought an iPod touch and I was impressed with the display and how well the touch screen responded to finger movements.  I wanted one too!  So I bought myself a present (an iPod touch 4th generation) and thought it might be fun to learn how to program it.  I had an idea for a game with a Jetpac.

I installed Xcode, Apple's free development suite and chose Cocos 2D as the graphics library after reading some good reviews.  Cocos is great.  It's easy to use, robust and comes with great 2D support.  It even allows you to use a physics engine in your game but I wanted to keep things simple and chose not to include this.  After all, a flying Jetpac is not rocket science...

I've done some game programming before on the PC using Visual C++ and DirectX and I was very impressed with the simplicity and beauty of the Xcode editor and compiler.  It comes with a useful iPod simulator (so you can quickly test the game while you are coding) but creating games is much more rewarding when you can play them on a real iPod.

Unfortunately this is not possible unless you sign up for Apple's IOS Developer Program which costs EUR 80 per year.  Needless to say, I signed up.  Another benefit of the IOS Developer Program is that it allows you to submit your apps to the iTunes store (after Apple has checked it).

It was fun learning the Cocos 2D library and the dialect of C that Apple calls Objective C.  I now have the beginnings of an actual game.  It's a simple platform game called 'Jetpac Piggy' because I like Jetpacs (and piggies).  Some of the highlights are:

  • Parallax scrolling (background layers move at different speeds depending on how far away they're supposed to be - giving the impression of depth).
  • 5 levels (so far).
  • Realistic Jetpac thrust, created with a particle designer.
  • Simple controls.  If you tilt the iPod left, space-piggy will fly left, and tilting it to the right will err... make it fly to the left some more.  Wait!  I can fix this! 
  • There are 2 buttons.  One is for thrust, the other is for using one of the space shields.  Useful when you get too close to a space mine.
  • iPod graphics are fast.  60 frames per second with 2 full-screen, scrolling backgrounds and various sprites and particles is not a problem at all.
Here is a screenshot (apologies to NASA for the egg-shaped planet - lets just say the visuals are distorted by the strong gravitational field on this particular planet):


More to follow...