Révision | d48be19f15943623d69f190588fb2e163657eb3e (tree) |
---|---|
l'heure | 2021-12-08 02:30:32 |
Auteur | sebastian_bugiu |
Commiter | sebastian_bugiu |
Various improvements.
@@ -319,6 +319,7 @@ | ||
319 | 319 | if (firePointer == pointer) { |
320 | 320 | firePointer = -1; |
321 | 321 | firePressed = false; |
322 | + game.getCanvas().recordKeyReleased(ExtendedCanvas.FIRE); | |
322 | 323 | } |
323 | 324 | if (arrowsPointer == pointer) { |
324 | 325 | arrowsPointer = -1; |
@@ -1,5 +1,6 @@ | ||
1 | 1 | package com.headwayent.spacerocket; |
2 | 2 | |
3 | +import com.badlogic.gdx.graphics.g2d.Sprite; | |
3 | 4 | import com.badlogic.gdx.graphics.g2d.TextureRegion; |
4 | 5 | |
5 | 6 | public class Utility { |
@@ -42,4 +43,8 @@ | ||
42 | 43 | public static long currentTimeMillis() { |
43 | 44 | return System.currentTimeMillis(); |
44 | 45 | } |
46 | + | |
47 | + public static boolean intersects(Sprite s0, Sprite s1) { | |
48 | + return s0.getX() < s1.getX() + s1.getWidth() && s0.getX() + s0.getWidth() > s1.getX() && s0.getY() < s1.getY() + s1.getHeight() && s0.getY() + s0.getHeight() > s1.getY(); | |
49 | + } | |
45 | 50 | } |
@@ -6,9 +6,10 @@ | ||
6 | 6 | |
7 | 7 | import java.util.Random; |
8 | 8 | |
9 | -import com.badlogic.gdx.graphics.g2d.TextureAtlas; | |
9 | +import com.badlogic.gdx.Gdx; | |
10 | 10 | import com.badlogic.gdx.graphics.g2d.TextureRegion; |
11 | 11 | import com.headwayent.spacerocket.SpaceRocket; |
12 | +import com.headwayent.spacerocket.Utility; | |
12 | 13 | |
13 | 14 | /** |
14 | 15 | * |
@@ -20,38 +21,36 @@ | ||
20 | 21 | private static final int CHANCE_TO_REVERT_M = 10; |
21 | 22 | private static final int CHANCE_TO_CHANGE_H = 30; |
22 | 23 | private static final int CHANCE_TO_CHANGE_M = 50; |
23 | - private static final int MINI_BOSS_X_SPEED = 12; | |
24 | - private static final int MINI_BOSS_Y_SPEED = 12; | |
25 | - private int InitialHealth; | |
24 | + private static final int MINI_BOSS_X_SPEED = 6 * 60; | |
25 | + private static final int MINI_BOSS_Y_SPEED = 3 * 60; | |
26 | + private int initialHealth; | |
26 | 27 | private int health; |
27 | - private boolean launched = false; | |
28 | + private boolean launched; | |
28 | 29 | private boolean bossDestroyed; |
29 | - private boolean bossDestroyedSP = false; | |
30 | - private boolean doubleDamage = false; | |
30 | + private boolean bossDestroyedSP; | |
31 | + private boolean doubleDamage; | |
31 | 32 | private int doubleDamageHitsRemaining; |
32 | - private float speedX, speedY; | |
33 | 33 | private int chanceToRevert, chanceToChange; |
34 | 34 | private boolean noChange; |
35 | 35 | |
36 | 36 | public BossSprite(TextureRegion textureRegion, String name, |
37 | 37 | int leftBound, int rightBound, int upperBound, int bottomBound, |
38 | - int frames, int NumHits, Status status) { | |
39 | - super(textureRegion, name, leftBound, rightBound, upperBound, bottomBound, frames, status); | |
40 | - | |
41 | - | |
42 | - InitialHealth = NumHits; | |
43 | - health = NumHits; | |
38 | + int frames, int numHits) { | |
39 | + super(textureRegion, name, leftBound, rightBound, upperBound, bottomBound, frames); | |
40 | + initialHealth = numHits; | |
41 | + health = numHits; | |
42 | + setIgnoreBoundaries(true); // So we don't get reset by ExtendedSprite.advance(). | |
44 | 43 | } |
45 | 44 | |
46 | 45 | public void enableDoubleHealth() { |
47 | - InitialHealth <<= 1; | |
46 | + initialHealth *= 2; | |
48 | 47 | } |
49 | 48 | |
50 | 49 | public boolean collisionCheck(RocketSprite s) { |
51 | 50 | |
52 | 51 | boolean ret = false; |
53 | 52 | try { |
54 | - if (getBoundingRectangle().overlaps(s.getBoundingRectangle())) { | |
53 | + if (Utility.intersects(this, s)) { | |
55 | 54 | s.reset(); |
56 | 55 | if (!doubleDamage) { |
57 | 56 | --health; |
@@ -65,8 +64,7 @@ | ||
65 | 64 | } |
66 | 65 | System.out.println("Boss Health " + health); |
67 | 66 | if (health <= 0) { |
68 | - this.resetExplode(); | |
69 | - this.reset(); | |
67 | + resetWithExplosion(); | |
70 | 68 | ret = true; |
71 | 69 | launched = false; |
72 | 70 | synchronized (this) { |
@@ -77,7 +75,7 @@ | ||
77 | 75 | |
78 | 76 | } |
79 | 77 | } catch (Exception e) { |
80 | - System.out.println("EnemySprite collision error"); | |
78 | + e.printStackTrace(); | |
81 | 79 | } |
82 | 80 | return ret; |
83 | 81 | } |
@@ -103,12 +101,7 @@ | ||
103 | 101 | doubleDamageHitsRemaining = 0; |
104 | 102 | bossDestroyedSP = false; |
105 | 103 | launched = false; |
106 | - health = InitialHealth; | |
107 | - } | |
108 | - | |
109 | - public void resetExplode() { | |
110 | - super.resetExplode(); | |
111 | - this.reset(); | |
104 | + health = initialHealth; | |
112 | 105 | } |
113 | 106 | |
114 | 107 | public void launchRandom() { |
@@ -127,12 +120,7 @@ | ||
127 | 120 | noChange = true; |
128 | 121 | } |
129 | 122 | } |
130 | - Random rand = SpaceRocket.getRandom(); | |
131 | - speedX = rand.nextInt(((int) ExtendedCanvas.hSpeed * 2) + 1) - ExtendedCanvas.hSpeed; | |
132 | - speedY = rand.nextInt((int) ExtendedCanvas.vSpeed) + (ExtendedCanvas.vSpeed - 1); | |
133 | - setSpeed(speedX, speedY); | |
134 | - this.setPosition(rand.nextInt((int) (getRightBound() - getLeftBound() - getWidth() + 1)), -getHeight()); | |
135 | - setVisible(true); | |
123 | + super.launchRandom(); | |
136 | 124 | launched = true; |
137 | 125 | } |
138 | 126 |
@@ -142,8 +130,7 @@ | ||
142 | 130 | |
143 | 131 | public void changeSpeed() { |
144 | 132 | Random rand = SpaceRocket.getRandom(); |
145 | - speedX = rand.nextInt(((int) ExtendedCanvas.hSpeed << 1) + 1) - ExtendedCanvas.hSpeed; | |
146 | - setSpeed(speedX, speedY); | |
133 | + setRandomSpeed(); | |
147 | 134 | } |
148 | 135 | |
149 | 136 | //false for x true for y |
@@ -151,7 +138,8 @@ | ||
151 | 138 | Random rand = SpaceRocket.getRandom(); |
152 | 139 | if(SpaceRocket.getGame().getGameMode() == SpaceRocket.GameMode.SP) { |
153 | 140 | if ((!noChange) && (rand.nextInt(chanceToRevert) == 0)) { |
154 | - | |
141 | + float speedX = getSpeedX(); | |
142 | + float speedY = getSpeedY(); | |
155 | 143 | if (b) { |
156 | 144 | speedY = -speedY; |
157 | 145 | } else { |
@@ -167,41 +155,54 @@ | ||
167 | 155 | public void advance() { |
168 | 156 | super.advance(); |
169 | 157 | Random rand = SpaceRocket.getRandom(); |
170 | - ExtendedSprite miniBossSprite = SpaceRocket.getGame().getCanvas().getGraphicsManager().getMiniBossPool().removeOne(); | |
171 | - if(miniBossSprite != null) { | |
172 | - float x = getX(); | |
173 | - float y = getY(); | |
174 | 158 | |
175 | - if(SpaceRocket.getGame().getGameMode() == SpaceRocket.GameMode.SP) { | |
176 | - if ((!noChange) && (rand.nextInt(chanceToChange) == 0)) { | |
177 | - changeSpeed(); | |
178 | - } | |
159 | + float x = getX(); | |
160 | + float y = getY(); | |
161 | + | |
162 | +// System.out.println("boss xPos: " + x + " yPos: " + y); | |
163 | + | |
164 | + if(SpaceRocket.getGame().getGameMode() == SpaceRocket.GameMode.SP) { | |
165 | + if ((!noChange) && (rand.nextInt(chanceToChange) == 0)) { | |
166 | + changeSpeed(); | |
179 | 167 | } |
180 | - if (x + getWidth() < getLeftBound()) { | |
181 | - x = ExtendedCanvas.getScreenWidth(); | |
182 | - if(!invertSpeed(false)) { | |
168 | + } | |
169 | + if (x + getWidth() < getLeftBound()) { | |
170 | + x = ExtendedCanvas.getScreenWidth(); | |
171 | + if(!invertSpeed(false)) { | |
172 | + ExtendedSprite miniBossSprite = SpaceRocket.getGame().getCanvas().getGraphicsManager().getMiniBossPool().removeOne(); | |
173 | + if (miniBossSprite != null) { | |
183 | 174 | miniBossSprite.launch(0, this.getY(), MINI_BOSS_X_SPEED, 0); |
184 | 175 | } |
185 | 176 | } |
186 | - if (x > getRightBound()) { | |
187 | - x = -getWidth(); | |
188 | - if(!invertSpeed(false)) { | |
177 | + } | |
178 | + if (x > getRightBound()) { | |
179 | + x = -getWidth(); | |
180 | + if(!invertSpeed(false)) { | |
181 | + ExtendedSprite miniBossSprite = SpaceRocket.getGame().getCanvas().getGraphicsManager().getMiniBossPool().removeOne(); | |
182 | + if (miniBossSprite != null) { | |
189 | 183 | miniBossSprite.launch(ExtendedCanvas.getScreenWidth(), this.getY(), -MINI_BOSS_X_SPEED, 0); |
190 | 184 | } |
191 | 185 | } |
192 | - if (y + getHeight() < getUpperBound()) { | |
193 | - y = ExtendedCanvas.getScreenHeight(); | |
194 | - if(!invertSpeed(true)) { | |
186 | + } | |
187 | + if (y + getHeight() < getUpperBound()) { | |
188 | + y = ExtendedCanvas.getScreenHeight(); | |
189 | + if(!invertSpeed(true)) { | |
190 | + ExtendedSprite miniBossSprite = SpaceRocket.getGame().getCanvas().getGraphicsManager().getMiniBossPool().removeOne(); | |
191 | + if (miniBossSprite != null) { | |
195 | 192 | miniBossSprite.launch(this.getX(), 0, 0, MINI_BOSS_Y_SPEED); |
196 | 193 | } |
197 | 194 | } |
198 | - if (y > getBottomBound()) { | |
199 | - y = -getHeight(); | |
200 | - if(!invertSpeed(true)) { | |
195 | + } | |
196 | + if (y > getBottomBound()) { | |
197 | + y = -getHeight(); | |
198 | + if(!invertSpeed(true)) { | |
199 | + ExtendedSprite miniBossSprite = SpaceRocket.getGame().getCanvas().getGraphicsManager().getMiniBossPool().removeOne(); | |
200 | + if (miniBossSprite != null) { | |
201 | 201 | miniBossSprite.launch(this.getX(), ExtendedCanvas.getScreenHeight(), 0, -MINI_BOSS_Y_SPEED); |
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |
205 | + setPosition(x, y); | |
205 | 206 | } |
206 | 207 | |
207 | 208 | public int getHealth() { |
@@ -2,18 +2,16 @@ | ||
2 | 2 | |
3 | 3 | import java.util.Random; |
4 | 4 | |
5 | -import com.badlogic.gdx.graphics.g2d.TextureAtlas; | |
6 | 5 | import com.badlogic.gdx.graphics.g2d.TextureRegion; |
7 | 6 | import com.headwayent.spacerocket.SpaceRocket; |
7 | +import com.headwayent.spacerocket.Utility; | |
8 | 8 | |
9 | 9 | public class EnemySprite extends ExtendedSprite { |
10 | - private Status status; | |
11 | 10 | |
12 | 11 | public EnemySprite(TextureRegion textureRegion, String name, |
13 | 12 | int leftBound, int rightBound, int upperBound, int bottomBound, |
14 | - int Frames, Status status) { | |
15 | - super(textureRegion, name, leftBound, rightBound, upperBound, bottomBound, Frames, true); | |
16 | - this.status = status; | |
13 | + int frames) { | |
14 | + super(textureRegion, name, leftBound, rightBound, upperBound, bottomBound, frames, true); | |
17 | 15 | } |
18 | 16 | |
19 | 17 | public boolean collisionCheck(RocketSprite s) { |
@@ -22,12 +20,12 @@ | ||
22 | 20 | System.out.println("NULL"); |
23 | 21 | } |
24 | 22 | try { |
25 | - if (getBoundingRectangle().overlaps(s.getBoundingRectangle())) { | |
23 | + if (Utility.intersects(this, s)) { | |
26 | 24 | ret = true; |
27 | 25 | if (!s.isDoubleDamage()) { |
28 | 26 | s.reset(); |
29 | 27 | } |
30 | - this.resetExplode(); | |
28 | + this.resetWithExplosion(); | |
31 | 29 | } |
32 | 30 | } catch (Exception e) { |
33 | 31 | System.out.println("EnemySprite collision error"); |
@@ -35,15 +33,6 @@ | ||
35 | 33 | return ret; |
36 | 34 | } |
37 | 35 | |
38 | - public void launch() { | |
39 | - Random rand = SpaceRocket.getRandom(); | |
40 | - float speedX = rand.nextInt(((int)ExtendedCanvas.hSpeed << 1) + 1) - ExtendedCanvas.hSpeed; | |
41 | - float speedY = rand.nextInt((int) ExtendedCanvas.vSpeed) + (ExtendedCanvas.vSpeed - 1); | |
42 | - setSpeed(speedX, speedY); | |
43 | - setPosition(rand.nextInt((int) (getRightBound() - getLeftBound() - getWidth() + 1)), -getHeight()); | |
44 | - setVisible(true); | |
45 | - } | |
46 | - | |
47 | 36 | public void launch(EnemyStats s) { |
48 | 37 | setSpeed((s.speedX - 5), s.speedY); //Little issue with signed int transfer |
49 | 38 | setPosition(s.positionX, s.positionY); |
@@ -46,11 +46,6 @@ | ||
46 | 46 | public static final int GAME_D_PRESSED = 1 << GAME_D; |
47 | 47 | public static final float ACCELEROMETER_ERROR = 3.0f; |
48 | 48 | public static final float FLOAT_EPSILON = 0.00001f; |
49 | - public static final float H_SPEED = 4; | |
50 | - public static final float H_SPEED_SM = 2; | |
51 | - public static final float V_SPEED = 4; | |
52 | - public static final float V_SPEED_SM = 2; | |
53 | - public static float hSpeed, vSpeed; | |
54 | 49 | private static final float CORNER_X = 0, CORNER_Y = 0; |
55 | 50 | private static final int NUM_LIVES = 10; |
56 | 51 | private static final int HIDDEN_KEY_NUM_PRESSES = 10; |
@@ -106,10 +101,6 @@ | ||
106 | 101 | public void updateDisplayMetrics() { |
107 | 102 | screenWidth = Gdx.graphics.getWidth(); |
108 | 103 | screenHeight = Gdx.graphics.getHeight(); |
109 | - hSpeed = (screenWidth > GraphicsManager.MIN_WIDTH || | |
110 | - screenHeight > GraphicsManager.MIN_HEIGHT) ? H_SPEED : H_SPEED_SM; | |
111 | - vSpeed = (screenHeight > GraphicsManager.MIN_HEIGHT || | |
112 | - screenHeight > GraphicsManager.MIN_HEIGHT) ? V_SPEED : V_SPEED_SM; | |
113 | 104 | } |
114 | 105 | |
115 | 106 | public ExtendedCanvas() { |
@@ -24,6 +24,7 @@ | ||
24 | 24 | private String name; |
25 | 25 | private ExtendedSpritePool pool; |
26 | 26 | private TextureRegion[] animationFrames; |
27 | + private boolean ignoreBoundaries; | |
27 | 28 | |
28 | 29 | public String getName() { |
29 | 30 | return name; |
@@ -58,7 +59,7 @@ | ||
58 | 59 | |
59 | 60 | private void restartAnimation() { |
60 | 61 | if (numFrames > 1) { |
61 | - animation = new Animation<>(0.25f, animationFrames); | |
62 | + animation = new Animation<>(0.05f, animationFrames); | |
62 | 63 | } |
63 | 64 | } |
64 | 65 |
@@ -91,6 +92,9 @@ | ||
91 | 92 | |
92 | 93 | public void reset() { |
93 | 94 | // System.out.println("Resetting " + name); |
95 | + if (name.contains("miniBossSprite")) { | |
96 | + System.out.println(); | |
97 | + } | |
94 | 98 | setVisible(false); |
95 | 99 | if (animation != null) { |
96 | 100 | animationStateTime = 0; |
@@ -132,26 +136,26 @@ | ||
132 | 136 | } |
133 | 137 | |
134 | 138 | public void advance() { |
135 | - float x = getX() + speedX; | |
136 | - float y = getY() + speedY; | |
137 | - if ((x + getWidth() > getLeftBound()) && (x < getRightBound()) && | |
138 | - (y + getHeight() > getUpperBound()) && (y < getBottomBound())) { | |
139 | + float x = getX() + speedX * Gdx.graphics.getDeltaTime(); | |
140 | + float y = getY() + speedY * Gdx.graphics.getDeltaTime(); | |
141 | + if (ignoreBoundaries || ((x + getWidth() > getLeftBound()) && (x < getRightBound()) && | |
142 | + (y + getHeight() > getUpperBound()) && (y < getBottomBound()))) { | |
139 | 143 | setPosition(x, y); |
140 | 144 | if (numFrames > 1 && !lastFrameReached) { |
141 | 145 | animationStateTime += Gdx.graphics.getDeltaTime(); |
142 | 146 | TextureRegion currentFrame = animation.getKeyFrame(animationStateTime, !lastFrameStick); |
143 | 147 | setRegion(currentFrame); |
144 | - for (int i = 0; i < animationFrames.length; ++i) { | |
145 | - if (animationFrames[i] == currentFrame) { | |
146 | - System.out.println(name + " currentFrame: " + i + " animationStateTime: " + animationStateTime); | |
147 | - break; | |
148 | - } | |
149 | - } | |
148 | +// for (int i = 0; i < animationFrames.length; ++i) { | |
149 | +// if (animationFrames[i] == currentFrame && name.contains("explosion")) { | |
150 | +// System.out.println(name + " currentFrame: " + i + " animationStateTime: " + animationStateTime); | |
151 | +// break; | |
152 | +// } | |
153 | +// } | |
150 | 154 | TextureRegion[] keyFrames = animation.getKeyFrames(); |
151 | 155 | if (currentFrame == keyFrames[keyFrames.length - 1]) { |
152 | 156 | lastFrameReached = true; |
153 | 157 | if (hiddenAfterLastFrame) { |
154 | - System.out.println("hiddenAfterLastFrame: " + name + " reset"); | |
158 | +// System.out.println("hiddenAfterLastFrame: " + name + " reset"); | |
155 | 159 | reset(); |
156 | 160 | } |
157 | 161 | } |
@@ -166,16 +170,22 @@ | ||
166 | 170 | } |
167 | 171 | |
168 | 172 | public void launch(float xPos, float yPos, float xSpeed, float ySpeed) { |
173 | +// System.out.println("Launching: " + name + " xPos: " + xPos + " yPos: " + yPos + " xSpeed: " + xSpeed + " ySpeed: " + ySpeed); | |
169 | 174 | setPosition(xPos, yPos); |
170 | 175 | setSpeed(xSpeed, ySpeed); |
171 | 176 | setVisible(true); |
172 | 177 | } |
173 | 178 | |
179 | + public void setRandomSpeed() { | |
180 | + Random rand = SpaceRocket.getRandom(); | |
181 | + setSpeed((rand.nextInt(5 * 12 + 1) - 30), (rand.nextInt(5) + 2) * 60); | |
182 | + } | |
183 | + | |
174 | 184 | //This is completely wrong for an "abstract" class |
175 | 185 | public void launchRandom() { |
176 | 186 | Random rand = SpaceRocket.getRandom(); |
177 | 187 | setPosition(rand.nextInt((int) rightBound), -this.getHeight()); |
178 | - setSpeed((rand.nextInt(5) - 2), rand.nextInt(7) + 3); | |
188 | + setRandomSpeed(); | |
179 | 189 | setVisible(true); |
180 | 190 | } |
181 | 191 |
@@ -194,7 +204,7 @@ | ||
194 | 204 | this.lastFrameStick = lastFrameStick; |
195 | 205 | } |
196 | 206 | |
197 | - public void resetExplode() { | |
207 | + public void resetWithExplosion() { | |
198 | 208 | GraphicsManager graphicsManager = SpaceRocket.getGame().getCanvas().getGraphicsManager(); |
199 | 209 | ExplosionSprite explosionSprite = graphicsManager.getExplosionPool().removeOne(); |
200 | 210 | if (explosionSprite != null) { |
@@ -210,7 +220,7 @@ | ||
210 | 220 | powerupSprite.launch(xPos, yPos, getSpeedX(), getSpeedY()); |
211 | 221 | } |
212 | 222 | } |
213 | - setVisible(false); | |
223 | + reset(); | |
214 | 224 | } |
215 | 225 | |
216 | 226 | public boolean isAllowOutOfBounds() { |
@@ -242,4 +252,12 @@ | ||
242 | 252 | public void setPool(ExtendedSpritePool pool) { |
243 | 253 | this.pool = pool; |
244 | 254 | } |
255 | + | |
256 | + public boolean isIgnoreBoundaries() { | |
257 | + return ignoreBoundaries; | |
258 | + } | |
259 | + | |
260 | + public void setIgnoreBoundaries(boolean ignoreBoundaries) { | |
261 | + this.ignoreBoundaries = ignoreBoundaries; | |
262 | + } | |
245 | 263 | } |
@@ -7,6 +7,7 @@ | ||
7 | 7 | import com.headwayent.spacerocket.InGameInputProcessor; |
8 | 8 | import com.headwayent.spacerocket.Preferences; |
9 | 9 | import com.headwayent.spacerocket.SpaceRocket; |
10 | +import com.headwayent.spacerocket.Utility; | |
10 | 11 | |
11 | 12 | import java.util.Random; |
12 | 13 |
@@ -29,7 +30,7 @@ | ||
29 | 30 | private static final int BOSS2_NUM_FRAMES = 3; |
30 | 31 | private static final int BOSS3_NUM_FRAMES = 4; |
31 | 32 | private static final int BOSS4_NUM_FRAMES = 1; |
32 | - private static final int BOSS1_SCORE = 20; | |
33 | + private static final int BOSS1_SCORE = 2; | |
33 | 34 | private static final int BOSS2_SCORE = 60; |
34 | 35 | private static final int BOSS3_SCORE = 120; |
35 | 36 | private static final int BOSS4_SCORE = 200; |
@@ -268,7 +269,7 @@ | ||
268 | 269 | int y = 0; |
269 | 270 | int width = (int) ExtendedCanvas.getScreenWidth(); |
270 | 271 | int height = (int) ExtendedCanvas.getScreenHeight(); |
271 | - explosion = new ExplosionSprite[16]; | |
272 | + explosion = new ExplosionSprite[64]; | |
272 | 273 | for (int i = 0; i < explosion.length; ++i) { |
273 | 274 | explosion[i] = new ExplosionSprite(explosionRegion, "explosion" + i, |
274 | 275 | x, width, y, height, 8, explodeSnd); //, 34, 33); |
@@ -301,7 +302,7 @@ | ||
301 | 302 | append(flamesSprite[i]); |
302 | 303 | flamesPool.add(flamesSprite[i]); |
303 | 304 | } |
304 | - smokeSprite = new SmokeSprite[16]; | |
305 | + smokeSprite = new SmokeSprite[64]; | |
305 | 306 | for(int i = 0; i < smokeSprite.length; ++i) { |
306 | 307 | smokeSprite[i] = new SmokeSprite(smokeRegion, "smokeSprite" + i, |
307 | 308 | x, width, y, height, 12); |
@@ -321,7 +322,7 @@ | ||
321 | 322 | append(powerupSprite[i]); |
322 | 323 | powerupPool.add(powerupSprite[i]); |
323 | 324 | } |
324 | - srrocketLeftSprite = new RocketSprite[16]; | |
325 | + srrocketLeftSprite = new RocketSprite[64]; | |
325 | 326 | for (int i = 0; i < srrocketLeftSprite.length; ++i) { |
326 | 327 | srrocketLeftSprite[i] = new RocketSprite(rocketLeftRegion, "srrocketLeftSprite" + i, |
327 | 328 | x, width, y, height, true, 8); |
@@ -329,7 +330,7 @@ | ||
329 | 330 | append(srrocketLeftSprite[i]); |
330 | 331 | rocketLeftPool.add(srrocketLeftSprite[i]); |
331 | 332 | } |
332 | - srrocketRightSprite = new RocketSprite[16]; | |
333 | + srrocketRightSprite = new RocketSprite[64]; | |
333 | 334 | for (int i = 0; i < srrocketRightSprite.length; ++i) { |
334 | 335 | srrocketRightSprite[i] = new RocketSprite(rocketRightRegion, "srrocketRightSprite" + i, |
335 | 336 | x, width, y, height, true, 8); |
@@ -337,8 +338,8 @@ | ||
337 | 338 | append(srrocketRightSprite[i]); |
338 | 339 | rocketRightPool.add(srrocketRightSprite[i]); |
339 | 340 | } |
340 | - tripleRocketSpriteCenter = new RocketSprite[16]; | |
341 | - otherTripleRocketSpriteCenter = new RocketSprite[16]; | |
341 | + tripleRocketSpriteCenter = new RocketSprite[64]; | |
342 | + otherTripleRocketSpriteCenter = new RocketSprite[64]; | |
342 | 343 | for (int i = 0; i < tripleRocketSpriteCenter.length; ++i) { |
343 | 344 | tripleRocketSpriteCenter[i] = new RocketSprite(centerRocketMultiRegion, "tripleRocketSpriteCenter" + i, |
344 | 345 | x, width, y, height, true, 1); |
@@ -350,8 +351,8 @@ | ||
350 | 351 | append(otherTripleRocketSpriteCenter[i]); |
351 | 352 | rocketTripleCenterPool.add(otherTripleRocketSpriteCenter[i]); |
352 | 353 | } |
353 | - tripleRocketSpriteLeft = new RocketSprite[16]; | |
354 | - otherTripleRocketSpriteLeft = new RocketSprite[16]; | |
354 | + tripleRocketSpriteLeft = new RocketSprite[64]; | |
355 | + otherTripleRocketSpriteLeft = new RocketSprite[64]; | |
355 | 356 | for (int i = 0; i < tripleRocketSpriteLeft.length; ++i) { |
356 | 357 | tripleRocketSpriteLeft[i] = new RocketSprite(leftRocketMultiRegion, "tripleRocketSpriteLeft" + i, |
357 | 358 | x, width, y, height, true, 1); |
@@ -362,8 +363,8 @@ | ||
362 | 363 | append(otherTripleRocketSpriteLeft[i]); |
363 | 364 | rocketTripleLeftPool.add(otherTripleRocketSpriteLeft[i]); |
364 | 365 | } |
365 | - tripleRocketSpriteRight = new RocketSprite[16]; | |
366 | - otherTripleRocketSpriteRight = new RocketSprite[16]; | |
366 | + tripleRocketSpriteRight = new RocketSprite[64]; | |
367 | + otherTripleRocketSpriteRight = new RocketSprite[64]; | |
367 | 368 | for (int i = 0; i < tripleRocketSpriteRight.length; ++i) { |
368 | 369 | tripleRocketSpriteRight[i] = new RocketSprite(rightRocketMultiRegion, "tripleRocketSpriteRight" + i, |
369 | 370 | x, width, y, height, true, 1); |
@@ -374,8 +375,8 @@ | ||
374 | 375 | append(otherTripleRocketSpriteRight[i]); |
375 | 376 | rocketTripleRightPool.add(otherTripleRocketSpriteRight[i]); |
376 | 377 | } |
377 | - doubleDamageRocketSprite = new RocketSprite[16]; | |
378 | - otherDoubleDamageRocketSprite = new RocketSprite[16]; | |
378 | + doubleDamageRocketSprite = new RocketSprite[64]; | |
379 | + otherDoubleDamageRocketSprite = new RocketSprite[64]; | |
379 | 380 | for (int i = 0; i < doubleDamageRocketSprite.length; ++i) { |
380 | 381 | doubleDamageRocketSprite[i] = new RocketSprite(doubleDamageRocketRegion, "doubleDamageRocketSprite" + i, |
381 | 382 | x, width, y, height, true, 4); |
@@ -388,7 +389,7 @@ | ||
388 | 389 | append(otherDoubleDamageRocketSprite[i]); |
389 | 390 | rocketDoubleDamagePool.add(otherDoubleDamageRocketSprite[i]); |
390 | 391 | } |
391 | - enemyrocketSprite = new RocketSprite[16]; | |
392 | + enemyrocketSprite = new RocketSprite[64]; | |
392 | 393 | for (int i = 0; i < enemyrocketSprite.length; ++i) { |
393 | 394 | numFrames = 0; |
394 | 395 | int r = SpaceRocket.getRandom().nextInt(4); |
@@ -410,26 +411,23 @@ | ||
410 | 411 | break; |
411 | 412 | } |
412 | 413 | enemyrocketSprite[i] = |
413 | - new RocketSprite(enemyRocketRegion[r], "enemyrocketSprite" + i, | |
414 | + new RocketSprite(enemyRocketRegion[r], "enemyRocketSprite" + i, | |
414 | 415 | x, width, y, height, false, numFrames); |
415 | 416 | append(enemyrocketSprite[i]); |
416 | 417 | rocketEnemyPool.add(enemyrocketSprite[i]); |
417 | 418 | } |
418 | 419 | |
419 | 420 | bossSprite = new BossSprite[4]; |
420 | - bossSprite[0] = new BossSprite(boss0Region, "boss0", x, width, y, height, BOSS1_NUM_FRAMES, BOSS1_HEALTH, status); | |
421 | - append(bossSprite[0]); | |
422 | - bossSprite[1] = new BossSprite(boss1Region, "boss1", x, width, y, height, BOSS2_NUM_FRAMES, BOSS2_HEALTH, status); | |
423 | - append(bossSprite[1]); | |
424 | - bossSprite[2] = new BossSprite(boss2Region, "boss2", x, width, y, height, BOSS3_NUM_FRAMES, BOSS3_HEALTH, status); | |
425 | - append(bossSprite[2]); | |
426 | - bossSprite[3] = new BossSprite(boss3Region, "boss3", x, width, y, height, BOSS4_NUM_FRAMES, BOSS4_HEALTH, status); | |
427 | - append(bossSprite[3]); | |
421 | + bossSprite[0] = new BossSprite(boss0Region, "boss0", x, width, y, height, BOSS1_NUM_FRAMES, BOSS1_HEALTH); | |
422 | + bossSprite[1] = new BossSprite(boss1Region, "boss1", x, width, y, height, BOSS2_NUM_FRAMES, BOSS2_HEALTH); | |
423 | + bossSprite[2] = new BossSprite(boss2Region, "boss2", x, width, y, height, BOSS3_NUM_FRAMES, BOSS3_HEALTH); | |
424 | + bossSprite[3] = new BossSprite(boss3Region, "boss3", x, width, y, height, BOSS4_NUM_FRAMES, BOSS4_HEALTH); | |
428 | 425 | for (BossSprite s : bossSprite) { |
426 | + append(s); | |
429 | 427 | bossPool.add(s); |
430 | 428 | } |
431 | 429 | |
432 | - enemy = new EnemySprite[8]; | |
430 | + enemy = new EnemySprite[64]; | |
433 | 431 | for (int i = 0; i < enemy.length; ++i) { |
434 | 432 | int r = SpaceRocket.getRandom().nextInt(4); |
435 | 433 | if (r == 0) { |
@@ -437,12 +435,12 @@ | ||
437 | 435 | } else { |
438 | 436 | numFrames = 1; |
439 | 437 | } |
440 | - enemy[i] = new EnemySprite(enemyRegion[r], "enemy" + i, x, width, y, height, numFrames, status); | |
438 | + enemy[i] = new EnemySprite(enemyRegion[r], "enemy" + i, x, width, y, height, numFrames); | |
441 | 439 | append(enemy[i]); |
442 | 440 | enemyPool.add(enemy[i]); |
443 | 441 | } |
444 | 442 | |
445 | - otherRocketLeftSprite = new RocketSprite[16]; | |
443 | + otherRocketLeftSprite = new RocketSprite[64]; | |
446 | 444 | for (int i = 0; i < otherRocketLeftSprite.length; ++i) { |
447 | 445 | otherRocketLeftSprite[i] = new RocketSprite( |
448 | 446 | rocketLeftRegion, "otherRocketLeftSprite" + i, |
@@ -451,7 +449,7 @@ | ||
451 | 449 | append(otherRocketLeftSprite[i]); |
452 | 450 | rocketLeftPool.add(otherRocketLeftSprite[i]); |
453 | 451 | } |
454 | - otherRocketRightSprite = new RocketSprite[16]; | |
452 | + otherRocketRightSprite = new RocketSprite[64]; | |
455 | 453 | for (int i = 0; i < otherRocketRightSprite.length; ++i) { |
456 | 454 | otherRocketRightSprite[i] = new RocketSprite( |
457 | 455 | rocketRightRegion, "otherRocketRightSprite" + i, |
@@ -463,7 +461,7 @@ | ||
463 | 461 | miniBossSprite = new ExtendedSprite[4]; |
464 | 462 | for (int i = 0; i < miniBossSprite.length; ++i) { |
465 | 463 | miniBossSprite[i] = new ExtendedSprite(miniBossRegion[i], "miniBossSprite" + i, |
466 | - x, width, y, height, 3); | |
464 | + x, width, y, height, 3, true); | |
467 | 465 | miniBossSprite[i].setVisible(false); |
468 | 466 | // bossSprite[i].setMiniBossSprite(miniBossSprite[i]); |
469 | 467 | append(miniBossSprite[i]); |
@@ -486,7 +484,7 @@ | ||
486 | 484 | append(atmosphereSprite); |
487 | 485 | |
488 | 486 | |
489 | - starSprite = new ExtendedSprite[32]; | |
487 | + starSprite = new ExtendedSprite[128]; | |
490 | 488 | for (int i = 0; i < starSprite.length; ++i) { |
491 | 489 | starSprite[i] = new ExtendedSprite(starRegion, "starSprite" + i, |
492 | 490 | x, width, y, height, 1); |
@@ -865,7 +863,7 @@ | ||
865 | 863 | Status status = spaceCanvas.getStatus(); |
866 | 864 | if (!spaceCanvas.getStatus().firstTime && spaceCanvas.getStatus().livesRemaining != 0) { |
867 | 865 | spaceRocket.advance(XDir, YDir, shoot); |
868 | - if (spaceRocket.getBoundingRectangle().overlaps(fireSprite.getBoundingRectangle())) { | |
866 | + if (Utility.intersects(spaceRocket, fireSprite)) { | |
869 | 867 | fireSprite.setRegion(touchFireTransRegion); |
870 | 868 | fireSpriteTransparent = true; |
871 | 869 | } else if (fireSpriteTransparent) { |
@@ -890,9 +888,9 @@ | ||
890 | 888 | if (showEarth) { |
891 | 889 | showEarth = false; |
892 | 890 | earthSprite.launch((ExtendedCanvas.getScreenWidth() * 0.5f) - (earthSprite.getWidth() * 0.5f), |
893 | - ExtendedCanvas.getScreenHeight() - earthSprite.getHeight(), 0, 1); | |
891 | + ExtendedCanvas.getScreenHeight() - earthSprite.getHeight(), 0, 1 * 60 * Gdx.graphics.getDeltaTime()); | |
894 | 892 | atmosphereSprite.launch((ExtendedCanvas.getScreenWidth() * 0.5f) - (atmosphereSprite.getWidth() * 0.5f), |
895 | - ExtendedCanvas.getScreenHeight() - atmosphereSprite.getHeight(), 0, 1); | |
893 | + ExtendedCanvas.getScreenHeight() - atmosphereSprite.getHeight(), 0, 1 * 60 * Gdx.graphics.getDeltaTime()); | |
896 | 894 | } |
897 | 895 | if (atmosphereSprite.getX() > 0) { |
898 | 896 | atmosphereSprite.setVisible(false); |
@@ -910,9 +908,9 @@ | ||
910 | 908 | } |
911 | 909 | if (rand.nextInt(10) == 0) { |
912 | 910 | for (int i = 0; i < starSprite.length; ++i) { |
913 | - if (!starSprite[i].isVisible()) { | |
914 | - starSprite[i].launchRandom(); | |
915 | - break; | |
911 | + ExtendedSprite starSprite = getStarPool().removeOne(); | |
912 | + if (starSprite != null) { | |
913 | + starSprite.launchRandom(); | |
916 | 914 | } |
917 | 915 | } |
918 | 916 | } |
@@ -998,7 +996,7 @@ | ||
998 | 996 | if ((isMP) && (connectionThread != null) && (connectionThread.getBossDestroyedByCoop())) { |
999 | 997 | int killedBoss = connectionThread.getKilledBoss(); |
1000 | 998 | if ((killedBoss >= 0) && (killedBoss < BOSS_COUNT) && (lastKilledBoss != killedBoss)) { |
1001 | - bossSprite[killedBoss].resetExplode(); | |
999 | + bossSprite[killedBoss].resetWithExplosion(); | |
1002 | 1000 | System.out.println("Boss: " + killedBoss + " has been killed"); |
1003 | 1001 | lastKilledBoss = killedBoss; |
1004 | 1002 | } else { |
@@ -1248,45 +1246,41 @@ | ||
1248 | 1246 | enemyRand = ENEMY_RAND_FINAL + diffHelp; |
1249 | 1247 | } |
1250 | 1248 | if ((enemyRand > 0) && (rand.nextInt(enemyRand) == 0)) { |
1251 | - for (int i = 0; i < enemy.length; ++i) { | |
1252 | - if (!enemy[i].isVisible()) { | |
1253 | - enemy[i].launchRandom(); | |
1254 | - break; | |
1255 | - } | |
1249 | + EnemySprite enemySprite = getEnemyPool().removeOne(); | |
1250 | + if (enemySprite != null) { | |
1251 | + enemySprite.launchRandom(); | |
1256 | 1252 | } |
1257 | 1253 | } |
1258 | 1254 | } else { |
1259 | 1255 | if ((connectionThread != null) && (connectionThread.getRocketLaunched())) { |
1260 | - for (int i = 0; i < enemy.length; ++i) { | |
1261 | - if (!enemy[i].isVisible()) { | |
1262 | - enemy[i].launch(connectionThread.getRocketXPos(), | |
1263 | - connectionThread.getRocketXSpeed(), | |
1264 | - connectionThread.getRocketYSpeed()); | |
1265 | - break; | |
1266 | - } | |
1256 | + EnemySprite enemySprite = getEnemyPool().removeOne(); | |
1257 | + if (enemySprite != null) { | |
1258 | + enemySprite.launch(connectionThread.getRocketXPos(), | |
1259 | + connectionThread.getRocketXSpeed(), | |
1260 | + connectionThread.getRocketYSpeed()); | |
1267 | 1261 | } |
1268 | 1262 | } |
1269 | 1263 | } |
1270 | 1264 | |
1271 | 1265 | if (isMP) { |
1272 | 1266 | if ((connectionThread != null) && (connectionThread.getBossLaunched())) { |
1273 | - int BossNum = connectionThread.GetBossNum(); | |
1274 | - if ((BossNum >= 0) && (BossNum < BOSS_COUNT)) { | |
1275 | - if (currentBoss != BossNum) { | |
1276 | - bossSprite[BossNum].launch(connectionThread.getBossXPos(), | |
1267 | + int bossNum = connectionThread.GetBossNum(); | |
1268 | + if ((bossNum >= 0) && (bossNum < BOSS_COUNT)) { | |
1269 | + if (currentBoss != bossNum) { | |
1270 | + bossSprite[bossNum].launch(connectionThread.getBossXPos(), | |
1277 | 1271 | connectionThread.getBossXSpeed(), |
1278 | 1272 | connectionThread.getBossYSpeed()); |
1279 | - bossSprite[BossNum].enableDoubleHealth(); | |
1273 | + bossSprite[bossNum].enableDoubleHealth(); | |
1280 | 1274 | if (Preferences.getInstance().isSoundEnabled()) { |
1281 | 1275 | Gdx.input.vibrate(500); |
1282 | 1276 | } |
1283 | - System.out.println("Boss: " + BossNum + " has been launched"); | |
1277 | + System.out.println("Boss: " + bossNum + " has been launched"); | |
1284 | 1278 | synchronized (this) { |
1285 | - currentBoss = BossNum; | |
1279 | + currentBoss = bossNum; | |
1286 | 1280 | } |
1287 | 1281 | } |
1288 | 1282 | } else { |
1289 | - System.out.println("Wrong bossnum: " + BossNum); | |
1283 | + System.out.println("Wrong bossnum: " + bossNum); | |
1290 | 1284 | } |
1291 | 1285 | } |
1292 | 1286 | } |
@@ -1524,7 +1518,7 @@ | ||
1524 | 1518 | for (int i = 0; i < miniBossSprite.length; ++i) { |
1525 | 1519 | if (miniBossSprite[i].isVisible()) { |
1526 | 1520 | miniBossSprite[i].advance(); |
1527 | - break; | |
1521 | +// break; | |
1528 | 1522 | } |
1529 | 1523 | } |
1530 | 1524 |
@@ -9,6 +9,7 @@ | ||
9 | 9 | import com.badlogic.gdx.graphics.g2d.TextureAtlas; |
10 | 10 | import com.badlogic.gdx.graphics.g2d.TextureRegion; |
11 | 11 | import com.headwayent.spacerocket.SpaceRocket; |
12 | +import com.headwayent.spacerocket.Utility; | |
12 | 13 | |
13 | 14 | /** |
14 | 15 | * |
@@ -30,7 +31,7 @@ | ||
30 | 31 | public int collisionCheck(SpaceRocketSprite s) { |
31 | 32 | int type = 0; |
32 | 33 | try { |
33 | - if(this.getBoundingRectangle().overlaps(s.getBoundingRectangle())) { | |
34 | + if(Utility.intersects(this, s)) { | |
34 | 35 | type = this.type; |
35 | 36 | this.reset(); |
36 | 37 | } |
@@ -5,15 +5,16 @@ | ||
5 | 5 | import com.badlogic.gdx.graphics.g2d.TextureAtlas; |
6 | 6 | import com.badlogic.gdx.graphics.g2d.TextureRegion; |
7 | 7 | import com.headwayent.spacerocket.SpaceRocket; |
8 | +import com.headwayent.spacerocket.Utility; | |
8 | 9 | |
9 | 10 | public class RocketSprite extends ExtendedSprite { |
10 | 11 | |
11 | 12 | private boolean upDirection; |
12 | 13 | private boolean doubleDamage; |
13 | - public static final int _SR_SPEED = -12; | |
14 | - public static final int _SR_SPEED_SM = -7; | |
15 | - public static final int _ENEMY_SPEED = 8; | |
16 | - public static final int _ENEMY_SPEED_SM = 4; | |
14 | + public static final int _SR_SPEED = -10 * 60; | |
15 | + public static final int _SR_SPEED_SM = -4 * 60; | |
16 | + public static final int _ENEMY_SPEED = 6 * 60; | |
17 | + public static final int _ENEMY_SPEED_SM = 2 * 60; | |
17 | 18 | public static int SR_SPEED; |
18 | 19 | public static int ENEMY_SPEED; |
19 | 20 |
@@ -36,7 +37,7 @@ | ||
36 | 37 | System.out.println("RocketSprite s == null"); |
37 | 38 | } |
38 | 39 | try { |
39 | - if (getBoundingRectangle().overlaps(s.getBoundingRectangle())) { | |
40 | + if (Utility.intersects(this, s)) { | |
40 | 41 | ret = true; |
41 | 42 | s.reset(); |
42 | 43 | if (!doubleDamage) { |
@@ -44,7 +45,7 @@ | ||
44 | 45 | } |
45 | 46 | } |
46 | 47 | } catch (Exception e) { |
47 | - System.out.println("SpaceRocketSprite collision error"); | |
48 | + e.printStackTrace(); | |
48 | 49 | } |
49 | 50 | return ret; |
50 | 51 | } |
@@ -58,7 +59,7 @@ | ||
58 | 59 | if (upDirection) { |
59 | 60 | speedY = SR_SPEED; |
60 | 61 | } else { |
61 | - speedY = SpaceRocket.getRandom().nextInt(ENEMY_SPEED) + (ENEMY_SPEED >> 2); | |
62 | + speedY = SpaceRocket.getRandom().nextInt(ENEMY_SPEED) + (ENEMY_SPEED / 4); | |
62 | 63 | } |
63 | 64 | setSpeed(0, speedY); |
64 | 65 | // released = true; |
@@ -75,20 +76,11 @@ | ||
75 | 76 | return upDirection; |
76 | 77 | } |
77 | 78 | |
78 | - /** | |
79 | - * @return the doubleDamage | |
80 | - */ | |
81 | 79 | public boolean isDoubleDamage() { |
82 | 80 | return doubleDamage; |
83 | 81 | } |
84 | 82 | |
85 | - /** | |
86 | - * @param doubleDamage the doubleDamage to set | |
87 | - */ | |
88 | 83 | public void setDoubleDamage(boolean doubleDamage) { |
89 | 84 | this.doubleDamage = doubleDamage; |
90 | 85 | } |
91 | - /* public void advance() { | |
92 | - move(speedX, speedY); | |
93 | - }*/ | |
94 | 86 | } |
@@ -19,19 +19,19 @@ | ||
19 | 19 | public static int SR_ACC_SPEED; |
20 | 20 | public static int SR_MAX_SPEED; |
21 | 21 | private static int ROCKET_DISTANCE; |
22 | - public static final int _ACC_SPEED = 2; | |
23 | - public static final int _MAX_SPEED = 7; | |
22 | + public static final int _ACC_SPEED = 1; | |
23 | + public static final int _MAX_SPEED = 5; | |
24 | 24 | private static final int _ROCKET_DISTANCE = -24; |
25 | 25 | public static final int _ACC_SPEED_SM = 1; |
26 | - public static final int _MAX_SPEED_SM = 4; | |
26 | + public static final int _MAX_SPEED_SM = 2; | |
27 | 27 | private static final int _ROCKET_DISTANCE_SM = -10; |
28 | 28 | private static final int NUM_LIVES = 10; |
29 | 29 | private static int MULTI_SHOOT_X_SPEED; |
30 | 30 | private static int MULTI_SHOOT_Y_SPEED; |
31 | - private static final int _MULTI_SHOOT_X_SPEED = 6; | |
32 | - private static final int _MULTI_SHOOT_X_SPEED_SM = 3; | |
33 | - private static final int _MULTI_SHOOT_Y_SPEED = 13; | |
34 | - private static final int _MULTI_SHOOT_Y_SPEED_SM = 7; | |
31 | + private static final int _MULTI_SHOOT_X_SPEED = 6 * 60; | |
32 | + private static final int _MULTI_SHOOT_X_SPEED_SM = 3 * 60; | |
33 | + private static final int _MULTI_SHOOT_Y_SPEED = 13 * 60; | |
34 | + private static final int _MULTI_SHOOT_Y_SPEED_SM = 7 * 60; | |
35 | 35 | public static final int STD_FRAME = 0; |
36 | 36 | public static final int GIVE_LIFE_FRAME = 0; |
37 | 37 | public static final int DOUBLE_DAMAGE_FRAME = 1; |
@@ -39,8 +39,8 @@ | ||
39 | 39 | public static final int INVINCIBILITY_FRAME = 0; |
40 | 40 | private static final int NUM_FRAMES = 3; |
41 | 41 | private static final long INVINCIBILITY_TICKS = 5000; |
42 | - private static final int _DOUBLE_DAMAGE_SPEED = -7; | |
43 | - private static final int _DOUBLE_DAMAGE_SPEED_SM = -4; | |
42 | + private static final int _DOUBLE_DAMAGE_SPEED = -7 * 60; | |
43 | + private static final int _DOUBLE_DAMAGE_SPEED_SM = -4 * 60; | |
44 | 44 | private static int DOUBLE_DAMAGE_SPEED; |
45 | 45 | private float speedX, speedY; |
46 | 46 | private long currentDelay; |
@@ -146,11 +146,11 @@ | ||
146 | 146 | return false; |
147 | 147 | } |
148 | 148 | try { |
149 | - if (getBoundingRectangle().overlaps(s.getBoundingRectangle())) { | |
149 | + if (Utility.intersects(this, s)) { | |
150 | 150 | ret = true; |
151 | 151 | if (!(s instanceof BossSprite)) { |
152 | 152 | |
153 | - s.resetExplode(); | |
153 | + s.resetWithExplosion(); | |
154 | 154 | } |
155 | 155 | if (Utility.hasTimePassed(currentInvincibilityTime, invincibilityTime)) { |
156 | 156 | spPos.x = getX(); |
@@ -178,7 +178,7 @@ | ||
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | try { |
181 | - if (getBoundingRectangle().overlaps(s.getBoundingRectangle())) { | |
181 | + if (Utility.intersects(this, s)) { | |
182 | 182 | ret = true; |
183 | 183 | s.reset(); |
184 | 184 |