Sunday, 1 September 2013

Project ‘Coding Oledium’ – Part 6

In part 6 the main thing worked on was the Case Statement that will provide the checks on what sPlayerAction has been received from the player. These mostly match our Mind Map that we created in Part 1, with a few additions thought up on the way.

The next item is to think about how to Loop and get the player to drop out of the game if a) they die or b) they Quit the game. In the previous post it seemed it was an If statement that would be simplest. Instead of that however, VBScript provides an even simpler way, using the Do Until... Loop construct.

Given we want to cover both the events of the player getting 0 Hit Points (aka becoming dead) and Quitting - we also need to use Or in the statement.

Using SciTe colouring it looks like this:

     Do Until iPlayerHp <= 0 OR sPlayerAction = "Quit"
     ... case statements


In this version there's also a few style issues that need sorting out. For example the sMsgBoxTitle string that we want as the title for all Message Boxes doesn't work in all instances that it's called - not figured out why yet...