QwMobilePositionedSprite Class Reference
#include <QwSpriteField.h>
Inherits QwPositionedSprite<COORD>.
List of all member functions.
Public Members
- QwMobilePositionedSprite ( QwSpritePixmapSequence * )
- QwMobilePositionedSprite ()
- void bounds ( COORD l, COORD t, COORD r, COORD b )
- void adoptSpritefieldBounds ()
- enum { Ignore, Stop, Wrap, Bounce }
- void setBoundsAction ( int a )
- bool outOfBounds ()
- void setVelocity ( COORD dX, COORD dY )
- COORD dX () const
- COORD dY () const
- void forward ( COORD multiplier )
- void forward ( COORD multiplier, int frame )
- Pix forwardHits ( COORD multiplier ) const
- Pix forwardHits ( COORD multiplier, int frame ) const
- void moveTo ( COORD x, COORD y )
- virtual void moveTo ( COORD x, COORD y, int frame )
Detailed Description
A QwPositionedSprite which has velocity as well as position, and a
bounding area in which it may move. This class is useful for simple
applications where objects have simple motion. More complex uses will
require use of one of the QwPositionedSprite derived classes,
QwSprite or QwRealSprite.
Member Function Documentation
QwMobilePositionedSprite::QwMobilePositionedSprite ()
Create a QwPositionedSprite without defining its image sequence.
Note that you must call setSequence(QwSpritePixmapSequence*) before doing anything else with the sprite.
QwMobilePositionedSprite::QwMobilePositionedSprite ( QwSpritePixmapSequence * )
Create a QwPositionedSprite which uses images from the given sequence.
void QwMobilePositionedSprite::adoptSpritefieldBounds ()
Use the width and height of the sprite's spritefield as the bounds.
This is the default when the sprite is created.
void QwMobilePositionedSprite::bounds ( COORD l, COORD t, COORD r, COORD b )
Set the bounds of the sprite's motion.
The default is the bounds of the Spritefield containing the sprite.
COORD QwMobilePositionedSprite::dX () const
Returns the horizontal velocity of the sprite.
See also: QwMobilePositionedSprite::setVelocity.
COORD QwMobilePositionedSprite::dY () const
Returns the vertical velocity of the sprite.
See also: QwMobilePositionedSprite::setVelocity.
void QwMobilePositionedSprite::forward ( COORD multiplier )
Move forward (or backward if multiplier is negative) by the given amount
multiplied by the current velocity of the sprite.
void QwMobilePositionedSprite::forward ( COORD multiplier, int frame )
Move forward (or backward if multiplier is negative) by the given amount
multiplied by the current velocity of the sprite, and set the frame to
the given index.
Pix QwMobilePositionedSprite::forwardHits ( COORD multiplier ) const
Returns an iterator over objects that might be hit if the sprite
moves forward. Note that if the movement would not change the pixel
position of the sprite, 0 is returned, even if the sprite is already
in contact with something - the assumption being that such a collision
has already been dealt with.
Pix QwMobilePositionedSprite::forwardHits ( COORD multiplier, int frame ) const
Returns an iterator over objects that might be hit if the sprite
moves forward, and changes frame. Note that if the movement would not change the pixel
position of the sprite, 0 is returned, even if the sprite is already
in contact with something - the assumption being that such a collision
has already been dealt with.
void QwMobilePositionedSprite::moveTo ( COORD x, COORD y )
Override to implement bounds action.
void QwMobilePositionedSprite::moveTo ( COORD x, COORD y, int frame ) [virtual]
Override to implement bounds action.
bool QwMobilePositionedSprite::outOfBounds ()
Returns TRUE if the sprite has moved out of its bounds. This should only
happen if the bounds action is set to Ignore.
void QwMobilePositionedSprite::setBoundsAction ( int a )
Set the action to perform when the sprite hits its bounds.
It can:
- Ignore the bounds, continuing on.
- Stop moving at the boundary.
- Wrap from one side of the boundary to the other.
- Bounce away from the boundary as it hits.
The default is to Ignore the bounds.
void QwMobilePositionedSprite::setVelocity ( COORD dX, COORD dY )
Set the velocity of the sprite. It will only actually move when
QwMobilePositionedSprite::forward is called.
This file is
copyright © 1995-97
Warwick Allison.
It was generated from the following files:
- QwSpriteField.h
- QwSpriteField-double.cpp
- QwSpriteField-int.cpp
- QwSpriteField-mobdouble.cpp
- QwSpriteField-mobint.cpp
- QwSpriteField-template.cpp
- QwSpriteField.cpp
Generated at 09:21, 1998/12/09 for Qt version 1.4 by the warwick at Troll Tech