Thursday 26 November 2009

Skeleton Program (Coursework)

Hi folks,

OK, I am sorry for those that expected this yesterday but it took about 4 hours longer than expected! At the bottom of this post is a link to a skeleton program that contains 4 screens, a thread and the RMS that you need to save and load user data. The RMS took a lot longer than expected and the music player you will get in tomorrow's lecture had to be coded tonight as well.

OK, so here's the details.

* You have a skeleton program that provides you with four screens
* Splash Screen
* User Info Screen
* Game Screen
* Game Over Screen

The example also shows you how to setup a game canvas with a game loop and provides the code to setting up and accessing persistent storage on a phone. If I am being totally honest I think you have all done rather well with this code!! I would STRONGLY advise you download the files and re-type them out. I feel that you get a better understanding when you are forced to type the code rather than copy and paste. It should take you about an hour to recopy my code into netbeans but I would encourage you to do so!

Regardless, I have tried my best to comment it to the point of ridicule so start with programming (or reading) in the following order

* GameMidlet
* SplashScreen
* UserInfoScreen
* GameScreen
* GameOverScreen

While I am happy to help in any way I can I would appreciate if you, as students, understood the effort and time that went into both your tutorial for Friday and this skeleton. All I ask is that you spend some of your time looking over it. You are welcome to rip off the code completely or pick and choose what you want to use.

If you have questions you are able to post to this blog or email me at c.mccreadie@abertay.ac.uk
You can of course wait until we have the next tutorial but feedback from the code is always helpful so any constructive criticism is welcome and encouraged.

See you all next week

See HERE for code.

EDIT: After downloading and extracting you should be able to open in netbeans if you "open project". I would still suggest re-typing the program but for those that need the quick fix ....

Chris

Tuesday 6 October 2009

Chessboard Tutorial

Some of you may have noticed the time of this post ( 10 hours before your class for some of you) but regardless....I cast aside my beer and my personal life and hacked up a very quick tutorial for you. Before I go any further I should say a big thank you to Scott Macaulay who not only gave me the idea for this tutorial but also part of the code!

There are three files to this tutorial. You can find them here but please read below before downloading.

The MIDlet is the ChessBoardMidlet.java file. When creating a new project make sure that you create a new Midlet before copying and pasting the code into it. The other 2 files are POJO's (Plain Old Java Objects) and should be created just as Java Class files.

The result should be a chessboard that has a green box that reacts to user input using the down button only. To carry on with this tutorial you should add code for the UP, LEFT and RIGHT key.

There is no real objective to the tutorial. The program starts off with a form asking for a username and an age (which does not need to be filled in) there are two or three buttons depending on which emulator you are using and all you need to do is click on the "Start Game" button to load the chess set. If you see any button that say qwerty please do not click on it as it is well outside the scope of your module. I hope it might give some of you a starter for your coursework or, at least, a better understanding of J2ME programming. There are plenty of comments but please feel free to ask for more info on anything. Please note that this is NOT a substitute for Geoff Lund's Tutorials and this should be considered as an additional but important extra.

For those that are interested in this tutorial, think about the following

1) Make the green cursor move down one square at a time, not 3/4 of a square.
2) Add methods for MoveRight(), MoveLeft(), MoveUp() to get the green "selection" square moving around the whole chessboard.
3) Think about different ways (perhaps even write them down) that you could visualise different chess pieces...text, sprites etc.

Cheers

Chris

Sunday 27 September 2009

Welcome: Abertay 3rd years

I realised that it had been a rather long time since my last post and, since I made most of you write down this blog, I felt it only fair to post on it and welcome you all to 3rd year and the joy (no, seriously) that is mobile development.

This blog should be looked upon as just part of your learning experience just as your lectures and tutorials do.


Anyways, more will be added this coming week.

Chris