Diffstat (limited to 'noncore/games/parashoot/man.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/parashoot/man.cpp | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/noncore/games/parashoot/man.cpp b/noncore/games/parashoot/man.cpp index 8435572..94807c2 100644 --- a/noncore/games/parashoot/man.cpp +++ b/noncore/games/parashoot/man.cpp @@ -1,5 +1,5 @@ /********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** -** This file is part of Qtopia Environment. +** This file is part of the Qtopia Environment. ** @@ -20,3 +20,3 @@ -#include "codes.h" +#include "codes.h" #include "man.h" @@ -24,3 +24,3 @@ -#include <qpe/resource.h> +#include <qtopia/resource.h> @@ -32,3 +32,3 @@ Man::Man(QCanvas* canvas) : QCanvasSprite(0, canvas), - splat("lose") + splat("lose") // No tr { @@ -37,3 +37,3 @@ Man::Man(QCanvas* canvas) : m0.replace(QRegExp("0001"),"%1"); - manarray->readPixmaps(m0, 7); + manarray->readPixmaps(m0, 7); setSequence(manarray); @@ -47,3 +47,3 @@ Man::Man(QCanvas* canvas, int x, int y) : QCanvasSprite(0, canvas), - splat("bang") + splat("bang") // No tr { @@ -64,3 +64,3 @@ Man::Man(QCanvas* canvas, int x, int y) : srand(midnight.secsTo(QTime::currentTime()) ); - } + } int yfallspeed = 0; @@ -94,5 +94,12 @@ void Man::advance(int phase) setVelocity(-2, 0); - } + } else if (xVelocity() == -2) { + // + // There's been a resize event while this Man has + // been on the ground. Move the man back to the + // new ground location. This is not neat. + // + move(x(), canvas()->height()-26); + } } -} +} @@ -112,3 +119,3 @@ void Man::setInitialCoords() void Man::checkCollision() -{ +{ if ( (x() < 23) && (y() == canvas()->height()-26)) { @@ -125,2 +132,12 @@ void Man::checkCollision() } + + // + // resize events may cause Man objects to appear + // outside the screen. Get rid of them if this + // is the case. + // + if ((x() < 0) || (x() > canvas()->width())) { + delete this; + return; + } } |