summaryrefslogtreecommitdiff
path: root/noncore/games/parashoot/man.cpp
Unidiff
Diffstat (limited to 'noncore/games/parashoot/man.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/parashoot/man.cpp39
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 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -20,3 +20,3 @@
20 20
21#include "codes.h" 21#include "codes.h"
22#include "man.h" 22#include "man.h"
@@ -24,3 +24,3 @@
24 24
25#include <qpe/resource.h> 25#include <qtopia/resource.h>
26 26
@@ -32,3 +32,3 @@ Man::Man(QCanvas* canvas) :
32 QCanvasSprite(0, canvas), 32 QCanvasSprite(0, canvas),
33 splat("lose") 33 splat("lose") // No tr
34{ 34{
@@ -37,3 +37,3 @@ Man::Man(QCanvas* canvas) :
37 m0.replace(QRegExp("0001"),"%1"); 37 m0.replace(QRegExp("0001"),"%1");
38 manarray->readPixmaps(m0, 7); 38 manarray->readPixmaps(m0, 7);
39 setSequence(manarray); 39 setSequence(manarray);
@@ -47,3 +47,3 @@ Man::Man(QCanvas* canvas, int x, int y) :
47 QCanvasSprite(0, canvas), 47 QCanvasSprite(0, canvas),
48 splat("bang") 48 splat("bang") // No tr
49{ 49{
@@ -64,3 +64,3 @@ Man::Man(QCanvas* canvas, int x, int y) :
64 srand(midnight.secsTo(QTime::currentTime()) ); 64 srand(midnight.secsTo(QTime::currentTime()) );
65 } 65 }
66 int yfallspeed = 0; 66 int yfallspeed = 0;
@@ -94,5 +94,12 @@ void Man::advance(int phase)
94 setVelocity(-2, 0); 94 setVelocity(-2, 0);
95 } 95 } else if (xVelocity() == -2) {
96 //
97 // There's been a resize event while this Man has
98 // been on the ground. Move the man back to the
99 // new ground location. This is not neat.
100 //
101 move(x(), canvas()->height()-26);
102 }
96 } 103 }
97} 104}
98 105
@@ -112,3 +119,3 @@ void Man::setInitialCoords()
112void Man::checkCollision() 119void Man::checkCollision()
113{ 120{
114 if ( (x() < 23) && (y() == canvas()->height()-26)) { 121 if ( (x() < 23) && (y() == canvas()->height()-26)) {
@@ -125,2 +132,12 @@ void Man::checkCollision()
125 } 132 }
133
134 //
135 // resize events may cause Man objects to appear
136 // outside the screen. Get rid of them if this
137 // is the case.
138 //
139 if ((x() < 0) || (x() > canvas()->width())) {
140 delete this;
141 return;
142 }
126} 143}