Public Member Functions | Static Public Member Functions | Protected Attributes | Properties

MovingObject Class Reference

Moving objects are the objects the player can touch to draw a Path for them. More...

#import <MovingObject.h>

Collaboration diagram for MovingObject:
Collaboration graph
[legend]

List of all members.

Public Member Functions

(id) - initMovingObjectWithDef:
 initializes class and returns an instance of the class, you must take care of allocating the object yourself
(bool) - canCollide
 returns true if the object can collide with others, otherwise false
(bool) - canFollowPath
 returns false if the object for whatever reason is out of the game, eg.
(bool) - isFollowingPath
 returns true for the duration that the object is assigned to a path as pathFollowObject
(void) - startPathFollow:
 assigns this object a path that it will follow from now on
(void) - moveTo:target:selector:
 move the object to a certain location and fixed speed, will perform selector when it arrived
(void) - moveTo:
 move the object to a certain location and fixed speed
(void) - moveToScreenBorder:
 object will move to the nearest screenborder in the given direction
(float) - moveIntoScreen
 called when object is spawned outside screen to have it move into the screen area
(void) - onTouch
 signals the object that it has been touched (selected), usesful to play a sound or animation or change state.
(void) - onPathPointAdded
 signals the object that another path point has been added, may trigger it to start moving
(void) - setProximityWarningEnabled:
 enables or disables the proximity warning image and plays sound
(void) - setCrashWarning
 enables the proximity warning and keeps it visible for longer
(void) - setState:
 sets the ObjectState of the object unless the object is already set to kStateInactive
(void) - dealloc [implementation]
(void) - moveInDirectionOfLocation: [implementation]
(void) - continueMovingInSameDirection [implementation]
(void) - stopPathFollow [implementation]
(void) - moveToNextPathPoint [implementation]
(void) - onArrivedAtPathPoint [implementation]
(void) - onArrivedAtTarget [implementation]
(void) - onFadeOutDone [implementation]
(void) - turnAroundAtScreenBorder [implementation]
 checks if the object is too close to the screen border and if so, it will turn the object around (it bounces back)
(void) - update: [implementation]
(void) - onProximityWarningTimeOut [implementation]
(void) - setStateInactive [implementation]
(bool) - canShowProximityWarning [implementation]

Static Public Member Functions

(id) + movingObjectWithDef:
 initializes class and returns an autoreleased instance of the class

Protected Attributes

Pathpath
 holds the pointer to a Path object as long as the object is following that path
CCSprite * proximityWarning
CGPoint prevPosition

Properties

ObjectDef def
 give access to this object's ObjectDef which defines the object's type and other parameters
EObjectStates state
 an object can only be in one state at a time (StateMachine concept)

Detailed Description

Moving objects are the objects the player can touch to draw a Path for them.

They have common attributes like movement speed, rotation speed, collision radius and bounding box (a CGRect) which are mostly determined by using a specific ObjectDef. MovingObject can also have children like the collision warning sprites, touch highlights and it plays sounds as appropriate.


Member Function Documentation

- (bool) canCollide  

returns true if the object can collide with others, otherwise false

- (bool) canFollowPath  

returns false if the object for whatever reason is out of the game, eg.

it crashed, left the screen, or landed

- (bool) canShowProximityWarning   [implementation]
- (void) continueMovingInSameDirection   [implementation]
- (void) dealloc   [implementation]
- (id) initMovingObjectWithDef: (ObjectDef objectDef  

initializes class and returns an instance of the class, you must take care of allocating the object yourself

- (bool) isFollowingPath  

returns true for the duration that the object is assigned to a path as pathFollowObject

- (void) moveInDirectionOfLocation: (CGPoint)  location   [implementation]
- (float) moveIntoScreen  

called when object is spawned outside screen to have it move into the screen area

- (void) moveTo: (CGPoint)  location  

move the object to a certain location and fixed speed

- (void) moveTo: (CGPoint)  location
target: (id)  target
selector: (SEL)  selector 

move the object to a certain location and fixed speed, will perform selector when it arrived

- (void) moveToNextPathPoint   [implementation]
- (void) moveToScreenBorder: (float)  direction  

object will move to the nearest screenborder in the given direction

+ (id) movingObjectWithDef: (ObjectDef objectDef  

initializes class and returns an autoreleased instance of the class

- (void) onArrivedAtPathPoint   [implementation]
- (void) onArrivedAtTarget   [implementation]
- (void) onFadeOutDone   [implementation]
- (void) onPathPointAdded  

signals the object that another path point has been added, may trigger it to start moving

- (void) onProximityWarningTimeOut   [implementation]
- (void) onTouch  

signals the object that it has been touched (selected), usesful to play a sound or animation or change state.

- (void) setCrashWarning  

enables the proximity warning and keeps it visible for longer

- (void) setProximityWarningEnabled: (bool)  enabled  

enables or disables the proximity warning image and plays sound

- (void) setState: (EObjectStates newState  

sets the ObjectState of the object unless the object is already set to kStateInactive

- (void) setStateInactive   [implementation]
- (void) startPathFollow: (Path*)  followPath  

assigns this object a path that it will follow from now on

- (void) stopPathFollow   [implementation]
- (void) turnAroundAtScreenBorder   [implementation]

checks if the object is too close to the screen border and if so, it will turn the object around (it bounces back)

- (void) update: (ccTime)  delta   [implementation]

Member Data Documentation

- (Path*) path [protected]

holds the pointer to a Path object as long as the object is following that path

- (CGPoint) prevPosition [protected]
- (CCSprite*) proximityWarning [protected]

Property Documentation

- (ObjectDef) def [read, assign]

give access to this object's ObjectDef which defines the object's type and other parameters

- (EObjectStates) state [read, assign]

an object can only be in one state at a time (StateMachine concept)

returns the current object state


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations Enumerator Properties