On 30 Nov 1995 17:34:17 -0500, MikeB22198 wrote:
> How would you program spells in a game? Individual code for eachThat's what I did. Some spells can be grouped tho, since their effect
only varies in quantity (eg. killing up to 10 people, or killing up to
1000 people). In these cases the spells can be put into an array with
the respective name, level, cost, description and effect, and this
group of spells can be handled by the same functions (using the array
index). In my game there are several groups of spells: combat spells
killing people, combat spells healing people, and a lot of indiviual
spells such as water poisoning, fire infernos, teleportation etc. The
individual spells are all coded individually (one big switch
statement). Before the switch which makes alle the effects, there is
one common part, checking for the ability of the unit to cast the
spell, deduce the money needed etc.
My game is a translated, improved version of Russel Wallace's game
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.