Saturday, 28 April 2012

Fishing Game: Now with fish.

So, after a burst of programming at 5am this morning, I have managed to make my boat's harpoon move as it should, as well as adding fish to the game.

As this is a learning experience, I have tried yet another way of handling graphics for the fish. Each fish will be animated, with at least 2 frames of animation. I could do this by storing each frame of animation separately (called fish1.bmp, fish2.bmp etc), but I have decided to organise them using sprite sheets. This is a large image containing several different frames of the same picture. When you want to use it, you tell the program to grab the appropriate section of the larger image.

You might not be able to tell, but the
two frames are slightly different.
I am hoping that this will also cut down on disk accessing, and may be more efficient.

So, I have created a class of fish which is quite adaptable. It should enable me to have lots of different fish which have different appearances, sizes, speeds, numbers of frames and score values. I can set my program to generate these fish as frequently as I wish, so later levels can be teeming with targets. Later levels will include fish which lose you points (such as endangered species) or damage your boat, (like an electric eel or a shark).

Beginners' harpoons will only be able to catch one fish before returning, but later upgrades will let you plough through a whole load of fish in one go!

Updated source files

No comments:

Post a Comment