Diablo style item spawning

BlitzMax Forums/BlitzMax Programming/Diablo style item spawning

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

while extending is great I disagree with deps usage. you don't what to extend to a specific usage like "type TDragon extends TMonster"... you will find that won't play out very well later in your design. think about this... if you want a random monster to appear, how do you want to code it?

a=rnd(10)
select a
case 1 d:TMonster = new TDragon
case 2 d:TMonster = new Torge
case 3 d:....
(also I think it's better not to get in the habit of downcasting unless you really need to.)

or

d:TMonster = TMonster.create(rnd(10))



basically if you are just changing data there is no reason to extend. the fly() method of TDragon is a good reason because it changes the capabilities of the type. But I would do something along the lines of
TFlyingMonster extends TMonster