Im a C++ prgrammer and old habits you now ;)
Anyway... you are correct... the example should look like this
VB Code:
dim MrX as new CMan
dim Merlin as new CMagician
Merlin.CastSpell(MrX,5,firespell)
and the castspell (implemented by all things that can perform magic) looks like this
VB Code:
public Sub CastSpell(byval target as Entity, byval strength as double, byref spellobj as CSpell)
target.WhenSpellCasted(myfirespell,strength)
and the code for "WhenSpellCasted"
VB Code:
public sub WhenSpellcasted(byval spell as cspell, byval strength as double)
'The spell object affects the attributes of the object it was cast on
spell.applymagic(Me,strength)
end sub
and finally the code for the fire spell object
VB Code:
public sub Applymagic(byval sucker as Entity, byval strength as double)
sucker.Life - = 100 * strength)
end sub
With this code I get an error on the line
Merlin.CastSpell(MrX,5,firespell)
and the precompiler complains that it can't cast from Entity to CMan :(
:confused:
any and all help is appreciated!!
kind regards
Henrik