The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Newsgroups: rec.games.design
From: a...@zool.unizh.ch (Alex Schroeder)
Date: 1995/12/01
Subject: Re: Programming spells
On 30 Nov 1995 17:34:17 -0500, MikeB22198 wrote:
> How would you program spells in a game? Individual code for each That's what I did. Some spells can be grouped tho, since their effect > spell? 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 Alex. 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.
| ||||||||||||||