Skip to Main Content
Game Magic
book

Game Magic

by Jeff Howard
April 2014
Intermediate to advanced content levelIntermediate to advanced
376 pages
10h 41m
English
A K Peters/CRC Press
Content preview from Game Magic
From Exemplary Game Magic Systems to Code Recipes 41
#define NUM_SPELL_EFFECT_PARAMS 5
struct SpellEffect {
enum ESpellEffectType type;
int params[NUM_SPELL_EFFECT_PARAMS];
};
#define NUM_SPELL_EFFECTS 5
struct Spell {
char* name;
int mpCost;
int level;
struct SpellEffect effects[NUM_SPELL_EFFECTS];
};
vo id CastSpell (const struct Spell* spell, struct Actor*
source, struct Actor* target) {
int effectIndex;
Pr intLog("%s cast%s on%s", source->name, spell->name,
target->name);
for (effectIndex = 0; effectIndex < NUM_SPELL_EFFECTS &&
sp ell->effects[effectIndex].type! = kEffectNone; ++
effectIndex) {
co nst struct SpellEffect* ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Game Art

Game Art

Matt Sainsbury
Game Design Theory

Game Design Theory

Keith Burgun

Publisher Resources

ISBN: 9781466567870