Rope Class Reference

Ropes are spriteObjects that a Player can use to climb up and down between platforms. More...

#include <rope.h>

Inherits spriteObject.

Inheritance diagram for Rope:

Inheritance graph
[legend]
Collaboration diagram for Rope:

Collaboration graph
[legend]
List of all members.

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.
RopegetParent () 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

RopeparentRope
 child Ropes have the parent (non-collidable) one set to this

Detailed Description

Ropes are spriteObjects that a Player can use to climb up and down between platforms.

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.

Author:
pospi

Definition at line 40 of file rope.h.


Constructor & Destructor Documentation

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.

Parameters:
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:

Rope::~Rope (  )  [virtual]

Definition at line 49 of file rope.cpp.


Member Function Documentation

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.

Parameters:
numRopes this many tiles will be added to the bottom
Returns:
true, because I haven't implemented any checking yet.

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]

Definition at line 52 of file rope.h.

References parentRope.

Referenced by Player::collidingWith().

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:


Member Data Documentation

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().


The documentation for this class was generated from the following files:
Generated on Tue Mar 13 23:27:55 2007 for MDuel DS by  doxygen 1.5.1-p1