summaryrefslogtreecommitdiff
path: root/noncore/games/parashoot/man.cpp
Unidiff
Diffstat (limited to 'noncore/games/parashoot/man.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/parashoot/man.cpp27
1 files changed, 22 insertions, 5 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,7 +1,7 @@
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**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
@@ -22,7 +22,7 @@
22#include "man.h" 22#include "man.h"
23#include "base.h" 23#include "base.h"
24 24
25#include <qpe/resource.h> 25#include <qtopia/resource.h>
26 26
27#include <qregexp.h> 27#include <qregexp.h>
28 28
@@ -30,7 +30,7 @@ int mancount;
30 30
31Man::Man(QCanvas* canvas) : 31Man::Man(QCanvas* canvas) :
32 QCanvasSprite(0, canvas), 32 QCanvasSprite(0, canvas),
33 splat("lose") 33 splat("lose") // No tr
34{ 34{
35 manarray = new QCanvasPixmapArray(); 35 manarray = new QCanvasPixmapArray();
36 QString m0 = Resource::findPixmap("parashoot/man0001"); 36 QString m0 = Resource::findPixmap("parashoot/man0001");
@@ -45,7 +45,7 @@ Man::Man(QCanvas* canvas) :
45 45
46Man::Man(QCanvas* canvas, int x, int y) : 46Man::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{
50 manarray = new QCanvasPixmapArray(); 50 manarray = new QCanvasPixmapArray();
51 QString m0 = Resource::findPixmap("parashoot/man0001"); 51 QString m0 = Resource::findPixmap("parashoot/man0001");
@@ -92,6 +92,13 @@ void Man::advance(int phase)
92 f++; 92 f++;
93 move(x(), canvas()->height()-26); 93 move(x(), canvas()->height()-26);
94 setVelocity(-2, 0); 94 setVelocity(-2, 0);
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);
95 } 102 }
96 } 103 }
97} 104}
@@ -123,6 +130,16 @@ void Man::checkCollision()
123 } 130 }
124 } 131 }
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}
127 144
128void Man::start() 145void Man::start()