Thursday, August 2, 2012

Sounds and More

So today was mostly about sounds.  After making another scene where the user can win the game, I saw a need for some little sound bits to play.  So, I experimented with an easy way to create simple 8-bit sounds.  I have created a few that I will put in the game for now.  Unfortunately Blogger will not let me upload the .wav file I created as a "video", so I will have to find another way to play sounds here.

Also, I went through and replaced some older code that was put in place temporarily to get level one developed.  This old code was hard wired to start level one, making adding more levels difficult.  Now there is a small system that level designers must use so that they dont have to dig through the code so much.  In the Main class, wherever there is a point where the engine must display something that is dependent on what level the user is on (for example: display the game over scene... but which level's game over scene do we display!?!?!) the game engine will call a router method.  This method is just a big switch so that the level designers can make sure the appropriate scenes and what not are displayed for what level the user is on.  Here is an example:

    public void routerForEndLossScene(){
        if(currentLevel == 1){
            show level one's loss scene   
         }//if
        if(currentLevel== 2){
            ...
        }//if
        ...
    }//method

I'm not sure if this is the best way of handling this sort of problem, but it is a simple one.  All these router methods are in the same location, making adding levels somewhat easier.

No comments:

Post a Comment