Monday, 14 September 2009

State, Activity, Bird Class and Minim

I'm recovering from a bout of flu and finding it even harder than usual, to concentrate on the logic needed to control the workflow.
At the moment I'm using booleans to control the states in the Birdie game but its getting very unwieldy and I'm beginning to think I need to factor out the bird animation into a new Bird class.
I will need to add a sound file of a bird going tweet. This should improve feedback when the birdie is clicked. The weather today is awful so I don't rate my chances of recording this today as very high. How on earth do I record this on my laptop? Does it have its own built in mike? Do I even have Audacity installed to edit the sound if I ever succeed in capturing it? Can Minim be used for the sound in the Processing applet without causing Out of Memory errors?
So my task for the week is to make a Bird class and add sound.
As I now use Processing 1.0.6 Minim is one of the standard libraries available so I didn't even need to download and unzip it.
I used the RecordPad Sound Recorder in Windows Vista and said "tweet tweet". Then I used some of the effects available to make the sound not sound like me going "tweet tweet". This produced a very strange tweety sound but lets face it, this is one very strange bird anyway!
I added my sound file to the sketch and edited the code provided by the Minim Quick Start Instructions. It worked first time and needed no more research! Thanks to the Minim team, when I remember the cartwheels I had to perform with threading and preloading to provide the sound in Solundria... this is a very welcome feature!
That Bird class really needs to be created now, as the sound is only playing the first time the birdie is clicked. I think the birdie state needs more work.
...
I added a Birdie class and this made handling the states in the game easier. I used the rewind function, after each play, so the sound now works fine. There's now a kinda score thing for each time the birdie is found.
Next week's tasks will be to add an endgame scene. I will need to find some suitable music too. The Birdie Song or Rockin Robin would've been nice but are likely copyrighted.
Latest version of Catch the Birdie. Use refresh to see latest version or start new game. feedback welcome...

No comments: