Re: Testing C++ highlighting
Quote:
Originally posted by Cander
Code:
#include "mage.h"
#include "fireball.h"
#include "level.h"
Mage::Mage(Level *l, DrawEngine *de, int s_index, float x, float y, int lives)
: Character(l, de, s_index, x, y, lives)
{
classID = MAGE_CLASSID;
}
bool Mage::keyPress(char c)
{
bool val = Character::keyPress(c);
if (val == false)
{
if (c == keys.attack)
{
castSpell();
return true;
}
}
return false;
}
void Mage::castSpell(void)
{
if (isValidMove((int)pos.x + facing.x, (int)pos.y + facing.y))
{
Fireball *temp = new Fireball(lvl, dengine, SPRITE_FIREBALL, (int)pos.x + facing.x,
(int)pos.y + facing.y, facing.x, facing.y);
lvl->addNPC((Sprite *)temp);
}
}
hehe cool, mind wont take much code to fill up the limit :D.