Tuesday, August 10, 2010

Very basic battle system implemented

Finally got some time to sit down and start work on a battle system.  As a novice programmer it is a daunting task - not so much the logic of the program but really trying to embrace OO concepts so I can easily resuse this system.  When I learnt to program it was 10 Print "Ado is awesome" 20 goto 10. Simple, linear stuff. 

Before I start rambling, I've put together something very basic, a simple UI that will let me spawn enemies.  I thought it would be a good exercise to understand instantiation.  It works well so far - the player is a static class (because I will only ever need one of them) and a new instance of "mob" is created when the "Spawn Enemy" button is pressed.  Right now it just creates a fearsome Giant Mushroom of Doom, but I would eventually like it to randomly pull from a list of Mobs.  Mob HP is a random number between 1 and 100.  My plan is to have Mob HP calculated based on a range that is dependant on the Mob Name/Type.

Finally we have just one attack in place.  It performs a simple hit roll by generating a number between 1 and 20 - if the number is higher than 10, it's a hit, and damage to the mob is calculated.  Right now damage is just a random number between 1 and 6, but that will change when different weapons and modifiers are in place.

Poor old Giant Mushroom of Doom cannot even fight back at this point.  Mob's will be able to take their turn soon enough, but until then, it's open season on every single monster that lives in my head.

No comments:

Post a Comment