diff options
author | Luke Bratch <l_bratch@yahoo.co.uk> | 2010-11-26 12:49:49 +0000 |
---|---|---|
committer | Luke Bratch <l_bratch@yahoo.co.uk> | 2010-11-26 12:49:49 +0000 |
commit | 4718c83d9204a0a9e2e0add143e829bbb9c0bff0 (patch) | |
tree | 51b5192285126af720c8d7df3b45ad6261e8b218 /Creature.cpp | |
parent | 5dd6f1089a86e69889056f3853b373025f68026f (diff) |
Implement Sprite::get/setClip for sprite sheet clipping & Creature::Orient for setting a
Creature's clip/orientation
Diffstat (limited to 'Creature.cpp')
-rw-r--r-- | Creature.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Creature.cpp b/Creature.cpp index 7693cb9..ba2a790 100644 --- a/Creature.cpp +++ b/Creature.cpp @@ -38,3 +38,14 @@ int Creature::getHealth() { void Creature::setHealth(int h) { health = h; } + +void Creature::orient() { + if (xVel < 0) + clipNo = ORIENT_LEFT; + else if (xVel > 0) + clipNo = ORIENT_RIGHT; + else if (yVel < 0) + clipNo = ORIENT_BACK; + else + clipNo = ORIENT_FRONT; +} |