Saturday, 28 July 2012

A Hesitation

I must get on with a new edition of Mythaxis, so I'm pausing a while.

I still have to sort out Music/Sound Effects. I'm also uncomfortable with the feel of long press as I've implemented it, so I'll have another go at that when I return.

Monday, 23 July 2012

Music Design Unsuccessful

Well, my sound implementation was not a great success. Some of it worked, some didn't, despite close monitoring on debug that the right things were being called with the right parameters. Specifically, setLoop didn't seem to work, nor did pause nor autopause. Most of the problems were with the background music and ambience sounds. The simple sound effects were fine.

I note a lot of such mysterious problems on Stackoverflow, and I may change policy here.

Also, I think it should have been a class rather than a method, and I'll re-write it like that. I may also have to use the MediaPlayer for longer music and the Soundpool just for immediate sound effects. We'll see. MediaPlayer is facility-rich, but seems rather complex to use.

Wednesday, 18 July 2012

Music Design Revised

There was no need for a separate thread to do the music. Once the sounds are loaded, it's a low usage thing, and I'll call it with the ticks.

Friday, 13 July 2012

Some Progress and a Design for Music and SFX

The Progress:
I realised I hadn't accounted for save and restore of holdable items. If it's already held, then all we need remember is the sprite that's being held. This can be achieved at the top level, where the player's current location is remembered. If, however, the sprite has been picked up and dropped away from its home screen, then the scene and x y have to be remembered. Code to do this is in test.

Design for Music and SFX:
It's currently my plan to use the SoundPool facility. This allows you to store a number of sound files with the application and also allows several channels to play at once. In this case, I would use one channel for the theme music or soundscape (e.g. birdsong, waves, wind etc.) of each scene, and another two for individual sound effects.
I think I can put this in a thread, which first loads the sounds, then is wakened up every 200 ms, say, which checks a variable in JadeView for each of the sound channels. Once it has started the channel, it sets the variable to "done". It can then see the next sound request when "done" is replaced. If the soundscape is unaltered, it just continues to play.

Tuesday, 10 July 2012

More on Cursors and Pick up & Drop

Cursors still have a few glitches. They tend to linger longer than they should. I shall try to make them only appear on screen when a touch is taking place - i.e. between ACTION_DOWN and ACTION_UP.

I implemented  Pick up & Drop using (as recommended by Android Developers) Long Press, rather than Double Click, which I had planned. So far, the Long Press seems too short at 384ms. It will be tuned.

I went for the complicated option - a gettable sprite that is also animated and scaled. That bit works fine

Monday, 2 July 2012

Cursor Implemented

I've now done the cursor. It's a Sprite, but with special characteristics. It only appears while you are touching the screen (ie between a down and an up event). It is invisible unless there is a zone or an active sprite under it. Actually, it was a little inconvenient as an entity. It might have been more "architectural" to have it as a separate class, but it had so much in common with a sprite that it was convenient, despite all the exceptions I had to introduce to its behaviour. There are currently 7 cursor shapes :
  • Default - blank
  • The four direction pointers
  • The crosshairs
  • The Hand - indicating something that can be operated or picked up. 
It's just over three months since I started the project. It feels good progress so far.
Still TODO:
  • Picking up and dropping items
  • Music and sounds. Probably using SoundPool.
  • Putting a Beta version together