See the file LICENSE for the license governing this code.
LevelObject > Character > AI > Enemy > Enemies
#pragma once
#include "Headers.h"
There are two ways of changing the general attributes of enemies:
attributes
in the enemy’s profile property list. Example: Assets/Profiles/Blob.plist
> attributes
> hp
= 5
.hp
property to 5
in the tmx file.Hops around randomly, clinging to walls and ceilings. Deals light damage and has low health.
class Blob : public Enemy
{
public:
virtual const char* const profileName() {return "Blob";}
Blob();
virtual ~Blob();
virtual void setProperties(Level& level, ValueMap& dict);
virtual void createFixtures();
virtual void attackedBy(LevelObject* o);
virtual void moodSeek(float delta);
virtual void die();
private:
typedef Enemy super;
typedef Blob self;
bool sticky;
bool clockwise;
Vec2 vec;
float speed;
int direction;
double jumpTime;
};
Jukes back and forth, every once in awhile firing a Bone
projectile in an arc toward the player.
Low hitpoints, medium damage.
class Skeleton : public Enemy
{
public:
virtual const char* const profileName() {return "Skeleton";}
Skeleton();
virtual ~Skeleton();
virtual void setProperties(Level& level, ValueMap& dict);
virtual void createFixtures();
virtual void moodSleep(float delta);
virtual void moodSeek(float delta);
virtual void moodAttack(float delta);
virtual void die();
private:
typedef Enemy super;
typedef Skeleton self;
bool retreat;
};
A miniboss. A statue that comes to life and jumps towards the player, shaking the screen. High hit points, high damage.
flip-x
or flip-y
(boolean 1
or true
) to flip the initial sprite.class Knight : public Enemy
{
public:
virtual const char* const profileName() {return "Knight";}
Knight();
virtual ~Knight();
virtual void setProperties(Level& level, ValueMap& dict);
virtual void createFixtures();
virtual void moodSleep(float delta);
virtual void moodSeek(float delta);
virtual void moodAttack(float delta);
virtual void die();
private:
typedef Enemy super;
typedef Knight self;
};
An AI
-controlled player. Used in networked multiplayer when a human player cannot be found.
Has the same abilities and attributes as a default player.
class BotPlayer : public Enemy
{
public:
virtual const char* const profileName() {return "BotPlayer";}
BotPlayer();
virtual ~BotPlayer();
virtual void setProperties(Level& level, ValueMap& dict);
virtual void createFixtures();
virtual void moodSleep(float delta);
virtual void moodSeek(float delta);
virtual void moodAttack(float delta);
virtual void die();
private:
typedef Enemy super;
typedef BotPlayer self;
};
Hangs on the ceiling and swoops down at the player. Low health, low damage.
class Bat : public Enemy
{
public:
virtual const char* const profileName() {return "Bat";}
Bat();
virtual ~Bat();
virtual void setProperties(Level& level, ValueMap& dict);
virtual void createFixtures();
virtual void moodSleep(float delta);
virtual void moodSeek(float delta);
virtual void moodAttack(float delta);
virtual void die();
private:
typedef Enemy super;
typedef Bat self;
float swoopX;
bool swoopUp;
};
Teleports around the level, firing MagicBall
projectiles at the player.
Medium health, medium damage.
class Mage : public Enemy
{
public:
virtual const char* const profileName() {return "Mage";}
Mage();
virtual ~Mage();
virtual void setProperties(Level& level, ValueMap& dict);
virtual void createFixtures();
virtual void moodSleep(float delta);
virtual void moodSeek(float delta);
virtual void moodAttack(float delta);
virtual void die();
virtual void isNowSolid();
private:
typedef Enemy super;
typedef Mage self;
};
A boss. Jumps and slams the ground, dealing a shockwave of explosions. Roars, beats chest, shakes the screen. High health, high damage.
Note: Sasquatch is not finished yet. Coming in the next release.
class Sasquatch : public Enemy
{
public:
virtual const char* const profileName() {return "Sasquatch";}
Sasquatch();
virtual ~Sasquatch();
virtual void setProperties(Level& level, ValueMap& dict);
virtual void createFixtures();
virtual void moodSleep(float delta);
virtual void moodSeek(float delta);
virtual void moodAttack(float delta);
virtual void die();
private:
typedef Enemy super;
typedef Sasquatch self;
};
Core
Object types