Diffstat (limited to 'noncore/games/parashoot/helicopter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/parashoot/helicopter.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/noncore/games/parashoot/helicopter.cpp b/noncore/games/parashoot/helicopter.cpp index 0923124..036b21e 100644 --- a/noncore/games/parashoot/helicopter.cpp +++ b/noncore/games/parashoot/helicopter.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 "codes.h" | 23 | #include "codes.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 | ||
@@ -37,7 +37,8 @@ Helicopter::Helicopter(QCanvas* canvas) : | |||
37 | QCanvasPixmapArray* helicopterarray = new QCanvasPixmapArray(); | 37 | QCanvasPixmapArray* helicopterarray = new QCanvasPixmapArray(); |
38 | QString h0 = Resource::findPixmap("parashoot/helicopter0001"); | 38 | QString h0 = Resource::findPixmap("parashoot/helicopter0001"); |
39 | h0.replace(QRegExp("0001"),"%1"); | 39 | h0.replace(QRegExp("0001"),"%1"); |
40 | helicopterarray->readPixmaps(h0,3 ); | 40 | helicopterarray->readPixmaps(h0,4 ); |
41 | |||
41 | setSequence(helicopterarray); | 42 | setSequence(helicopterarray); |
42 | setAnimated(true); | 43 | setAnimated(true); |
43 | move(canvas->width(), 5); | 44 | move(canvas->width(), 5); |
@@ -57,9 +58,18 @@ void Helicopter::advance(int phase) | |||
57 | { | 58 | { |
58 | QCanvasSprite::advance(phase); | 59 | QCanvasSprite::advance(phase); |
59 | if (phase == 0) { | 60 | if (phase == 0) { |
60 | setFrame(fr%3); | 61 | if (frame() == 3) { |
61 | fr++; | 62 | delete this; |
62 | checkCollision(); | 63 | return; |
64 | } | ||
65 | |||
66 | if (hits >= 2) { | ||
67 | setFrame(3); | ||
68 | } else { | ||
69 | setFrame(fr%3); | ||
70 | fr++; | ||
71 | checkCollision(); | ||
72 | } | ||
63 | } | 73 | } |
64 | } | 74 | } |
65 | 75 | ||
@@ -83,10 +93,6 @@ void Helicopter::dropman() | |||
83 | void Helicopter::done() | 93 | void Helicopter::done() |
84 | { | 94 | { |
85 | hits++; | 95 | hits++; |
86 | if (hits >= 2) { | ||
87 | setAnimated(false); | ||
88 | delete this; | ||
89 | } | ||
90 | } | 96 | } |
91 | 97 | ||
92 | void Helicopter::takeOff() | 98 | void Helicopter::takeOff() |