#include <rope.h>
Inherits spriteObject.
Inheritance diagram for Rope:
Public Member Functions | |
Rope (spriteManager *newsm, bool isCap=true) | |
Create a Rope and assign it a spriteManager. | |
virtual | ~Rope () |
virtual void | setPos (s16 nx, s16 ny) |
When setting this Rope's position, all childRopes should move along with it. | |
bool | setLength (u8 numRopes) |
Set the length of this Rope to this many child sprites, which are each 16 pixels high. | |
Rope * | getParent () const |
virtual void | makeStatic () |
When this Rope is made static (immobile and not calling collision checks), all of its Rope::childRopes should follow suit. | |
Public Attributes | |
vector< Rope * > | childRopes |
child Rope sprites if this is a parent Rope | |
u16 | childGFX |
id of GFX for Rope children to load in automatically | |
Static Public Attributes | |
static const u8 | ROPETOLERANCE = 5 |
the number of pixels each side of a Rope that counts as touching if a Player's center is within them | |
Protected Attributes | |
Rope * | parentRope |
child Ropes have the parent (non-collidable) one set to this |
To create a rope on the playing field, one Rope object is spawned and given a length. It will spawn as many child Rope sprites as it needs to meet this length. The parent Rope is drawn as a small ball, whilst its children are drawn as a brown line, thus making the rope appear affixed to something.
Definition at line 40 of file rope.h.
Rope::Rope | ( | spriteManager * | newsm, | |
bool | isCap = true | |||
) |
Create a Rope and assign it a spriteManager.
Creating a parent Rope will in turn create several child Ropes - these are essentially dumb graphics and perform not much more than hittests with the Players.
newsm | the spriteManager which should manage this spriteObject | |
isCap | true if this Rope is the parent Rope of its descendants |
Definition at line 30 of file rope.cpp.
References spriteObject::COL_NONE, spriteObject::COL_SOLID, spriteObject::setBounds(), spriteObject::setCollision(), spriteObject::setFrame(), and spriteObject::setLayer().
Referenced by setLength().
Here is the call graph for this function:
void Rope::setPos | ( | s16 | nx, | |
s16 | ny | |||
) | [virtual] |
When setting this Rope's position, all childRopes should move along with it.
Reimplemented from spriteObject.
Definition at line 98 of file rope.cpp.
References spriteObject::centery, childRopes, and spriteObject::setPos().
Referenced by gameManager::generateRopes().
Here is the call graph for this function:
bool Rope::setLength | ( | u8 | numRopes | ) |
Set the length of this Rope to this many child sprites, which are each 16 pixels high.
numRopes | this many tiles will be added to the bottom |
Definition at line 71 of file rope.cpp.
References spriteObject::centery, childGFX, childRopes, spriteObject::getx(), spriteObject::gety(), spriteObject::palleteID, Rope(), and spriteObject::sm.
Referenced by gameManager::generateRopes().
Here is the call graph for this function:
Rope* Rope::getParent | ( | ) | const [inline] |
void Rope::makeStatic | ( | ) | [virtual] |
When this Rope is made static (immobile and not calling collision checks), all of its Rope::childRopes should follow suit.
Reimplemented from spriteObject.
Definition at line 58 of file rope.cpp.
References childRopes, and spriteObject::makeStatic().
Referenced by gameManager::generateRopes().
Here is the call graph for this function:
const u8 Rope::ROPETOLERANCE = 5 [static] |
the number of pixels each side of a Rope that counts as touching if a Player's center is within them
Definition at line 50 of file rope.h.
Referenced by Player::collidingWith().
vector<Rope*> Rope::childRopes |
child Rope sprites if this is a parent Rope
Definition at line 55 of file rope.h.
Referenced by Player::basicInput(), makeStatic(), setLength(), and setPos().
u16 Rope::childGFX |
id of GFX for Rope children to load in automatically
Definition at line 60 of file rope.h.
Referenced by gameManager::generateRopes(), and setLength().
Rope* Rope::parentRope [protected] |
child Ropes have the parent (non-collidable) one set to this
Definition at line 64 of file rope.h.
Referenced by getParent().