QwMobilePositionedSprite Class Reference


#include <QwSpriteField.h>

Inherits QwPositionedSprite<COORD>.

List of all member functions.

Public Members


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:

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:


Generated at 09:21, 1998/12/09 for Qt version 1.4 by the warwick at Troll Tech