• R/O
  • SSH

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révisiond48be19f15943623d69f190588fb2e163657eb3e (tree)
l'heure2021-12-08 02:30:32
Auteursebastian_bugiu
Commitersebastian_bugiu

Message de Log

Various improvements.

Change Summary

Modification

diff -r fe59f8dfa109 -r d48be19f1594 core/src/com/headwayent/spacerocket/InGameInputProcessor.java
--- a/core/src/com/headwayent/spacerocket/InGameInputProcessor.java Sun Dec 05 20:50:17 2021 +0200
+++ b/core/src/com/headwayent/spacerocket/InGameInputProcessor.java Tue Dec 07 19:30:32 2021 +0200
@@ -319,6 +319,7 @@
319319 if (firePointer == pointer) {
320320 firePointer = -1;
321321 firePressed = false;
322+ game.getCanvas().recordKeyReleased(ExtendedCanvas.FIRE);
322323 }
323324 if (arrowsPointer == pointer) {
324325 arrowsPointer = -1;
diff -r fe59f8dfa109 -r d48be19f1594 core/src/com/headwayent/spacerocket/Utility.java
--- a/core/src/com/headwayent/spacerocket/Utility.java Sun Dec 05 20:50:17 2021 +0200
+++ b/core/src/com/headwayent/spacerocket/Utility.java Tue Dec 07 19:30:32 2021 +0200
@@ -1,5 +1,6 @@
11 package com.headwayent.spacerocket;
22
3+import com.badlogic.gdx.graphics.g2d.Sprite;
34 import com.badlogic.gdx.graphics.g2d.TextureRegion;
45
56 public class Utility {
@@ -42,4 +43,8 @@
4243 public static long currentTimeMillis() {
4344 return System.currentTimeMillis();
4445 }
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+ }
4550 }
diff -r fe59f8dfa109 -r d48be19f1594 core/src/com/headwayent/spacerocket/old/BossSprite.java
--- a/core/src/com/headwayent/spacerocket/old/BossSprite.java Sun Dec 05 20:50:17 2021 +0200
+++ b/core/src/com/headwayent/spacerocket/old/BossSprite.java Tue Dec 07 19:30:32 2021 +0200
@@ -6,9 +6,10 @@
66
77 import java.util.Random;
88
9-import com.badlogic.gdx.graphics.g2d.TextureAtlas;
9+import com.badlogic.gdx.Gdx;
1010 import com.badlogic.gdx.graphics.g2d.TextureRegion;
1111 import com.headwayent.spacerocket.SpaceRocket;
12+import com.headwayent.spacerocket.Utility;
1213
1314 /**
1415 *
@@ -20,38 +21,36 @@
2021 private static final int CHANCE_TO_REVERT_M = 10;
2122 private static final int CHANCE_TO_CHANGE_H = 30;
2223 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;
2627 private int health;
27- private boolean launched = false;
28+ private boolean launched;
2829 private boolean bossDestroyed;
29- private boolean bossDestroyedSP = false;
30- private boolean doubleDamage = false;
30+ private boolean bossDestroyedSP;
31+ private boolean doubleDamage;
3132 private int doubleDamageHitsRemaining;
32- private float speedX, speedY;
3333 private int chanceToRevert, chanceToChange;
3434 private boolean noChange;
3535
3636 public BossSprite(TextureRegion textureRegion, String name,
3737 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().
4443 }
4544
4645 public void enableDoubleHealth() {
47- InitialHealth <<= 1;
46+ initialHealth *= 2;
4847 }
4948
5049 public boolean collisionCheck(RocketSprite s) {
5150
5251 boolean ret = false;
5352 try {
54- if (getBoundingRectangle().overlaps(s.getBoundingRectangle())) {
53+ if (Utility.intersects(this, s)) {
5554 s.reset();
5655 if (!doubleDamage) {
5756 --health;
@@ -65,8 +64,7 @@
6564 }
6665 System.out.println("Boss Health " + health);
6766 if (health <= 0) {
68- this.resetExplode();
69- this.reset();
67+ resetWithExplosion();
7068 ret = true;
7169 launched = false;
7270 synchronized (this) {
@@ -77,7 +75,7 @@
7775
7876 }
7977 } catch (Exception e) {
80- System.out.println("EnemySprite collision error");
78+ e.printStackTrace();
8179 }
8280 return ret;
8381 }
@@ -103,12 +101,7 @@
103101 doubleDamageHitsRemaining = 0;
104102 bossDestroyedSP = false;
105103 launched = false;
106- health = InitialHealth;
107- }
108-
109- public void resetExplode() {
110- super.resetExplode();
111- this.reset();
104+ health = initialHealth;
112105 }
113106
114107 public void launchRandom() {
@@ -127,12 +120,7 @@
127120 noChange = true;
128121 }
129122 }
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();
136124 launched = true;
137125 }
138126
@@ -142,8 +130,7 @@
142130
143131 public void changeSpeed() {
144132 Random rand = SpaceRocket.getRandom();
145- speedX = rand.nextInt(((int) ExtendedCanvas.hSpeed << 1) + 1) - ExtendedCanvas.hSpeed;
146- setSpeed(speedX, speedY);
133+ setRandomSpeed();
147134 }
148135
149136 //false for x true for y
@@ -151,7 +138,8 @@
151138 Random rand = SpaceRocket.getRandom();
152139 if(SpaceRocket.getGame().getGameMode() == SpaceRocket.GameMode.SP) {
153140 if ((!noChange) && (rand.nextInt(chanceToRevert) == 0)) {
154-
141+ float speedX = getSpeedX();
142+ float speedY = getSpeedY();
155143 if (b) {
156144 speedY = -speedY;
157145 } else {
@@ -167,41 +155,54 @@
167155 public void advance() {
168156 super.advance();
169157 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();
174158
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();
179167 }
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) {
183174 miniBossSprite.launch(0, this.getY(), MINI_BOSS_X_SPEED, 0);
184175 }
185176 }
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) {
189183 miniBossSprite.launch(ExtendedCanvas.getScreenWidth(), this.getY(), -MINI_BOSS_X_SPEED, 0);
190184 }
191185 }
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) {
195192 miniBossSprite.launch(this.getX(), 0, 0, MINI_BOSS_Y_SPEED);
196193 }
197194 }
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) {
201201 miniBossSprite.launch(this.getX(), ExtendedCanvas.getScreenHeight(), 0, -MINI_BOSS_Y_SPEED);
202202 }
203203 }
204204 }
205+ setPosition(x, y);
205206 }
206207
207208 public int getHealth() {
diff -r fe59f8dfa109 -r d48be19f1594 core/src/com/headwayent/spacerocket/old/EnemySprite.java
--- a/core/src/com/headwayent/spacerocket/old/EnemySprite.java Sun Dec 05 20:50:17 2021 +0200
+++ b/core/src/com/headwayent/spacerocket/old/EnemySprite.java Tue Dec 07 19:30:32 2021 +0200
@@ -2,18 +2,16 @@
22
33 import java.util.Random;
44
5-import com.badlogic.gdx.graphics.g2d.TextureAtlas;
65 import com.badlogic.gdx.graphics.g2d.TextureRegion;
76 import com.headwayent.spacerocket.SpaceRocket;
7+import com.headwayent.spacerocket.Utility;
88
99 public class EnemySprite extends ExtendedSprite {
10- private Status status;
1110
1211 public EnemySprite(TextureRegion textureRegion, String name,
1312 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);
1715 }
1816
1917 public boolean collisionCheck(RocketSprite s) {
@@ -22,12 +20,12 @@
2220 System.out.println("NULL");
2321 }
2422 try {
25- if (getBoundingRectangle().overlaps(s.getBoundingRectangle())) {
23+ if (Utility.intersects(this, s)) {
2624 ret = true;
2725 if (!s.isDoubleDamage()) {
2826 s.reset();
2927 }
30- this.resetExplode();
28+ this.resetWithExplosion();
3129 }
3230 } catch (Exception e) {
3331 System.out.println("EnemySprite collision error");
@@ -35,15 +33,6 @@
3533 return ret;
3634 }
3735
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-
4736 public void launch(EnemyStats s) {
4837 setSpeed((s.speedX - 5), s.speedY); //Little issue with signed int transfer
4938 setPosition(s.positionX, s.positionY);
diff -r fe59f8dfa109 -r d48be19f1594 core/src/com/headwayent/spacerocket/old/ExtendedCanvas.java
--- a/core/src/com/headwayent/spacerocket/old/ExtendedCanvas.java Sun Dec 05 20:50:17 2021 +0200
+++ b/core/src/com/headwayent/spacerocket/old/ExtendedCanvas.java Tue Dec 07 19:30:32 2021 +0200
@@ -46,11 +46,6 @@
4646 public static final int GAME_D_PRESSED = 1 << GAME_D;
4747 public static final float ACCELEROMETER_ERROR = 3.0f;
4848 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;
5449 private static final float CORNER_X = 0, CORNER_Y = 0;
5550 private static final int NUM_LIVES = 10;
5651 private static final int HIDDEN_KEY_NUM_PRESSES = 10;
@@ -106,10 +101,6 @@
106101 public void updateDisplayMetrics() {
107102 screenWidth = Gdx.graphics.getWidth();
108103 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;
113104 }
114105
115106 public ExtendedCanvas() {
diff -r fe59f8dfa109 -r d48be19f1594 core/src/com/headwayent/spacerocket/old/ExtendedSprite.java
--- a/core/src/com/headwayent/spacerocket/old/ExtendedSprite.java Sun Dec 05 20:50:17 2021 +0200
+++ b/core/src/com/headwayent/spacerocket/old/ExtendedSprite.java Tue Dec 07 19:30:32 2021 +0200
@@ -24,6 +24,7 @@
2424 private String name;
2525 private ExtendedSpritePool pool;
2626 private TextureRegion[] animationFrames;
27+ private boolean ignoreBoundaries;
2728
2829 public String getName() {
2930 return name;
@@ -58,7 +59,7 @@
5859
5960 private void restartAnimation() {
6061 if (numFrames > 1) {
61- animation = new Animation<>(0.25f, animationFrames);
62+ animation = new Animation<>(0.05f, animationFrames);
6263 }
6364 }
6465
@@ -91,6 +92,9 @@
9192
9293 public void reset() {
9394 // System.out.println("Resetting " + name);
95+ if (name.contains("miniBossSprite")) {
96+ System.out.println();
97+ }
9498 setVisible(false);
9599 if (animation != null) {
96100 animationStateTime = 0;
@@ -132,26 +136,26 @@
132136 }
133137
134138 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()))) {
139143 setPosition(x, y);
140144 if (numFrames > 1 && !lastFrameReached) {
141145 animationStateTime += Gdx.graphics.getDeltaTime();
142146 TextureRegion currentFrame = animation.getKeyFrame(animationStateTime, !lastFrameStick);
143147 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+// }
150154 TextureRegion[] keyFrames = animation.getKeyFrames();
151155 if (currentFrame == keyFrames[keyFrames.length - 1]) {
152156 lastFrameReached = true;
153157 if (hiddenAfterLastFrame) {
154- System.out.println("hiddenAfterLastFrame: " + name + " reset");
158+// System.out.println("hiddenAfterLastFrame: " + name + " reset");
155159 reset();
156160 }
157161 }
@@ -166,16 +170,22 @@
166170 }
167171
168172 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);
169174 setPosition(xPos, yPos);
170175 setSpeed(xSpeed, ySpeed);
171176 setVisible(true);
172177 }
173178
179+ public void setRandomSpeed() {
180+ Random rand = SpaceRocket.getRandom();
181+ setSpeed((rand.nextInt(5 * 12 + 1) - 30), (rand.nextInt(5) + 2) * 60);
182+ }
183+
174184 //This is completely wrong for an "abstract" class
175185 public void launchRandom() {
176186 Random rand = SpaceRocket.getRandom();
177187 setPosition(rand.nextInt((int) rightBound), -this.getHeight());
178- setSpeed((rand.nextInt(5) - 2), rand.nextInt(7) + 3);
188+ setRandomSpeed();
179189 setVisible(true);
180190 }
181191
@@ -194,7 +204,7 @@
194204 this.lastFrameStick = lastFrameStick;
195205 }
196206
197- public void resetExplode() {
207+ public void resetWithExplosion() {
198208 GraphicsManager graphicsManager = SpaceRocket.getGame().getCanvas().getGraphicsManager();
199209 ExplosionSprite explosionSprite = graphicsManager.getExplosionPool().removeOne();
200210 if (explosionSprite != null) {
@@ -210,7 +220,7 @@
210220 powerupSprite.launch(xPos, yPos, getSpeedX(), getSpeedY());
211221 }
212222 }
213- setVisible(false);
223+ reset();
214224 }
215225
216226 public boolean isAllowOutOfBounds() {
@@ -242,4 +252,12 @@
242252 public void setPool(ExtendedSpritePool pool) {
243253 this.pool = pool;
244254 }
255+
256+ public boolean isIgnoreBoundaries() {
257+ return ignoreBoundaries;
258+ }
259+
260+ public void setIgnoreBoundaries(boolean ignoreBoundaries) {
261+ this.ignoreBoundaries = ignoreBoundaries;
262+ }
245263 }
diff -r fe59f8dfa109 -r d48be19f1594 core/src/com/headwayent/spacerocket/old/GraphicsManager.java
--- a/core/src/com/headwayent/spacerocket/old/GraphicsManager.java Sun Dec 05 20:50:17 2021 +0200
+++ b/core/src/com/headwayent/spacerocket/old/GraphicsManager.java Tue Dec 07 19:30:32 2021 +0200
@@ -7,6 +7,7 @@
77 import com.headwayent.spacerocket.InGameInputProcessor;
88 import com.headwayent.spacerocket.Preferences;
99 import com.headwayent.spacerocket.SpaceRocket;
10+import com.headwayent.spacerocket.Utility;
1011
1112 import java.util.Random;
1213
@@ -29,7 +30,7 @@
2930 private static final int BOSS2_NUM_FRAMES = 3;
3031 private static final int BOSS3_NUM_FRAMES = 4;
3132 private static final int BOSS4_NUM_FRAMES = 1;
32- private static final int BOSS1_SCORE = 20;
33+ private static final int BOSS1_SCORE = 2;
3334 private static final int BOSS2_SCORE = 60;
3435 private static final int BOSS3_SCORE = 120;
3536 private static final int BOSS4_SCORE = 200;
@@ -268,7 +269,7 @@
268269 int y = 0;
269270 int width = (int) ExtendedCanvas.getScreenWidth();
270271 int height = (int) ExtendedCanvas.getScreenHeight();
271- explosion = new ExplosionSprite[16];
272+ explosion = new ExplosionSprite[64];
272273 for (int i = 0; i < explosion.length; ++i) {
273274 explosion[i] = new ExplosionSprite(explosionRegion, "explosion" + i,
274275 x, width, y, height, 8, explodeSnd); //, 34, 33);
@@ -301,7 +302,7 @@
301302 append(flamesSprite[i]);
302303 flamesPool.add(flamesSprite[i]);
303304 }
304- smokeSprite = new SmokeSprite[16];
305+ smokeSprite = new SmokeSprite[64];
305306 for(int i = 0; i < smokeSprite.length; ++i) {
306307 smokeSprite[i] = new SmokeSprite(smokeRegion, "smokeSprite" + i,
307308 x, width, y, height, 12);
@@ -321,7 +322,7 @@
321322 append(powerupSprite[i]);
322323 powerupPool.add(powerupSprite[i]);
323324 }
324- srrocketLeftSprite = new RocketSprite[16];
325+ srrocketLeftSprite = new RocketSprite[64];
325326 for (int i = 0; i < srrocketLeftSprite.length; ++i) {
326327 srrocketLeftSprite[i] = new RocketSprite(rocketLeftRegion, "srrocketLeftSprite" + i,
327328 x, width, y, height, true, 8);
@@ -329,7 +330,7 @@
329330 append(srrocketLeftSprite[i]);
330331 rocketLeftPool.add(srrocketLeftSprite[i]);
331332 }
332- srrocketRightSprite = new RocketSprite[16];
333+ srrocketRightSprite = new RocketSprite[64];
333334 for (int i = 0; i < srrocketRightSprite.length; ++i) {
334335 srrocketRightSprite[i] = new RocketSprite(rocketRightRegion, "srrocketRightSprite" + i,
335336 x, width, y, height, true, 8);
@@ -337,8 +338,8 @@
337338 append(srrocketRightSprite[i]);
338339 rocketRightPool.add(srrocketRightSprite[i]);
339340 }
340- tripleRocketSpriteCenter = new RocketSprite[16];
341- otherTripleRocketSpriteCenter = new RocketSprite[16];
341+ tripleRocketSpriteCenter = new RocketSprite[64];
342+ otherTripleRocketSpriteCenter = new RocketSprite[64];
342343 for (int i = 0; i < tripleRocketSpriteCenter.length; ++i) {
343344 tripleRocketSpriteCenter[i] = new RocketSprite(centerRocketMultiRegion, "tripleRocketSpriteCenter" + i,
344345 x, width, y, height, true, 1);
@@ -350,8 +351,8 @@
350351 append(otherTripleRocketSpriteCenter[i]);
351352 rocketTripleCenterPool.add(otherTripleRocketSpriteCenter[i]);
352353 }
353- tripleRocketSpriteLeft = new RocketSprite[16];
354- otherTripleRocketSpriteLeft = new RocketSprite[16];
354+ tripleRocketSpriteLeft = new RocketSprite[64];
355+ otherTripleRocketSpriteLeft = new RocketSprite[64];
355356 for (int i = 0; i < tripleRocketSpriteLeft.length; ++i) {
356357 tripleRocketSpriteLeft[i] = new RocketSprite(leftRocketMultiRegion, "tripleRocketSpriteLeft" + i,
357358 x, width, y, height, true, 1);
@@ -362,8 +363,8 @@
362363 append(otherTripleRocketSpriteLeft[i]);
363364 rocketTripleLeftPool.add(otherTripleRocketSpriteLeft[i]);
364365 }
365- tripleRocketSpriteRight = new RocketSprite[16];
366- otherTripleRocketSpriteRight = new RocketSprite[16];
366+ tripleRocketSpriteRight = new RocketSprite[64];
367+ otherTripleRocketSpriteRight = new RocketSprite[64];
367368 for (int i = 0; i < tripleRocketSpriteRight.length; ++i) {
368369 tripleRocketSpriteRight[i] = new RocketSprite(rightRocketMultiRegion, "tripleRocketSpriteRight" + i,
369370 x, width, y, height, true, 1);
@@ -374,8 +375,8 @@
374375 append(otherTripleRocketSpriteRight[i]);
375376 rocketTripleRightPool.add(otherTripleRocketSpriteRight[i]);
376377 }
377- doubleDamageRocketSprite = new RocketSprite[16];
378- otherDoubleDamageRocketSprite = new RocketSprite[16];
378+ doubleDamageRocketSprite = new RocketSprite[64];
379+ otherDoubleDamageRocketSprite = new RocketSprite[64];
379380 for (int i = 0; i < doubleDamageRocketSprite.length; ++i) {
380381 doubleDamageRocketSprite[i] = new RocketSprite(doubleDamageRocketRegion, "doubleDamageRocketSprite" + i,
381382 x, width, y, height, true, 4);
@@ -388,7 +389,7 @@
388389 append(otherDoubleDamageRocketSprite[i]);
389390 rocketDoubleDamagePool.add(otherDoubleDamageRocketSprite[i]);
390391 }
391- enemyrocketSprite = new RocketSprite[16];
392+ enemyrocketSprite = new RocketSprite[64];
392393 for (int i = 0; i < enemyrocketSprite.length; ++i) {
393394 numFrames = 0;
394395 int r = SpaceRocket.getRandom().nextInt(4);
@@ -410,26 +411,23 @@
410411 break;
411412 }
412413 enemyrocketSprite[i] =
413- new RocketSprite(enemyRocketRegion[r], "enemyrocketSprite" + i,
414+ new RocketSprite(enemyRocketRegion[r], "enemyRocketSprite" + i,
414415 x, width, y, height, false, numFrames);
415416 append(enemyrocketSprite[i]);
416417 rocketEnemyPool.add(enemyrocketSprite[i]);
417418 }
418419
419420 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);
428425 for (BossSprite s : bossSprite) {
426+ append(s);
429427 bossPool.add(s);
430428 }
431429
432- enemy = new EnemySprite[8];
430+ enemy = new EnemySprite[64];
433431 for (int i = 0; i < enemy.length; ++i) {
434432 int r = SpaceRocket.getRandom().nextInt(4);
435433 if (r == 0) {
@@ -437,12 +435,12 @@
437435 } else {
438436 numFrames = 1;
439437 }
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);
441439 append(enemy[i]);
442440 enemyPool.add(enemy[i]);
443441 }
444442
445- otherRocketLeftSprite = new RocketSprite[16];
443+ otherRocketLeftSprite = new RocketSprite[64];
446444 for (int i = 0; i < otherRocketLeftSprite.length; ++i) {
447445 otherRocketLeftSprite[i] = new RocketSprite(
448446 rocketLeftRegion, "otherRocketLeftSprite" + i,
@@ -451,7 +449,7 @@
451449 append(otherRocketLeftSprite[i]);
452450 rocketLeftPool.add(otherRocketLeftSprite[i]);
453451 }
454- otherRocketRightSprite = new RocketSprite[16];
452+ otherRocketRightSprite = new RocketSprite[64];
455453 for (int i = 0; i < otherRocketRightSprite.length; ++i) {
456454 otherRocketRightSprite[i] = new RocketSprite(
457455 rocketRightRegion, "otherRocketRightSprite" + i,
@@ -463,7 +461,7 @@
463461 miniBossSprite = new ExtendedSprite[4];
464462 for (int i = 0; i < miniBossSprite.length; ++i) {
465463 miniBossSprite[i] = new ExtendedSprite(miniBossRegion[i], "miniBossSprite" + i,
466- x, width, y, height, 3);
464+ x, width, y, height, 3, true);
467465 miniBossSprite[i].setVisible(false);
468466 // bossSprite[i].setMiniBossSprite(miniBossSprite[i]);
469467 append(miniBossSprite[i]);
@@ -486,7 +484,7 @@
486484 append(atmosphereSprite);
487485
488486
489- starSprite = new ExtendedSprite[32];
487+ starSprite = new ExtendedSprite[128];
490488 for (int i = 0; i < starSprite.length; ++i) {
491489 starSprite[i] = new ExtendedSprite(starRegion, "starSprite" + i,
492490 x, width, y, height, 1);
@@ -865,7 +863,7 @@
865863 Status status = spaceCanvas.getStatus();
866864 if (!spaceCanvas.getStatus().firstTime && spaceCanvas.getStatus().livesRemaining != 0) {
867865 spaceRocket.advance(XDir, YDir, shoot);
868- if (spaceRocket.getBoundingRectangle().overlaps(fireSprite.getBoundingRectangle())) {
866+ if (Utility.intersects(spaceRocket, fireSprite)) {
869867 fireSprite.setRegion(touchFireTransRegion);
870868 fireSpriteTransparent = true;
871869 } else if (fireSpriteTransparent) {
@@ -890,9 +888,9 @@
890888 if (showEarth) {
891889 showEarth = false;
892890 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());
894892 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());
896894 }
897895 if (atmosphereSprite.getX() > 0) {
898896 atmosphereSprite.setVisible(false);
@@ -910,9 +908,9 @@
910908 }
911909 if (rand.nextInt(10) == 0) {
912910 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();
916914 }
917915 }
918916 }
@@ -998,7 +996,7 @@
998996 if ((isMP) && (connectionThread != null) && (connectionThread.getBossDestroyedByCoop())) {
999997 int killedBoss = connectionThread.getKilledBoss();
1000998 if ((killedBoss >= 0) && (killedBoss < BOSS_COUNT) && (lastKilledBoss != killedBoss)) {
1001- bossSprite[killedBoss].resetExplode();
999+ bossSprite[killedBoss].resetWithExplosion();
10021000 System.out.println("Boss: " + killedBoss + " has been killed");
10031001 lastKilledBoss = killedBoss;
10041002 } else {
@@ -1248,45 +1246,41 @@
12481246 enemyRand = ENEMY_RAND_FINAL + diffHelp;
12491247 }
12501248 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();
12561252 }
12571253 }
12581254 } else {
12591255 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());
12671261 }
12681262 }
12691263 }
12701264
12711265 if (isMP) {
12721266 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(),
12771271 connectionThread.getBossXSpeed(),
12781272 connectionThread.getBossYSpeed());
1279- bossSprite[BossNum].enableDoubleHealth();
1273+ bossSprite[bossNum].enableDoubleHealth();
12801274 if (Preferences.getInstance().isSoundEnabled()) {
12811275 Gdx.input.vibrate(500);
12821276 }
1283- System.out.println("Boss: " + BossNum + " has been launched");
1277+ System.out.println("Boss: " + bossNum + " has been launched");
12841278 synchronized (this) {
1285- currentBoss = BossNum;
1279+ currentBoss = bossNum;
12861280 }
12871281 }
12881282 } else {
1289- System.out.println("Wrong bossnum: " + BossNum);
1283+ System.out.println("Wrong bossnum: " + bossNum);
12901284 }
12911285 }
12921286 }
@@ -1524,7 +1518,7 @@
15241518 for (int i = 0; i < miniBossSprite.length; ++i) {
15251519 if (miniBossSprite[i].isVisible()) {
15261520 miniBossSprite[i].advance();
1527- break;
1521+// break;
15281522 }
15291523 }
15301524
diff -r fe59f8dfa109 -r d48be19f1594 core/src/com/headwayent/spacerocket/old/PowerupSprite.java
--- a/core/src/com/headwayent/spacerocket/old/PowerupSprite.java Sun Dec 05 20:50:17 2021 +0200
+++ b/core/src/com/headwayent/spacerocket/old/PowerupSprite.java Tue Dec 07 19:30:32 2021 +0200
@@ -9,6 +9,7 @@
99 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
1010 import com.badlogic.gdx.graphics.g2d.TextureRegion;
1111 import com.headwayent.spacerocket.SpaceRocket;
12+import com.headwayent.spacerocket.Utility;
1213
1314 /**
1415 *
@@ -30,7 +31,7 @@
3031 public int collisionCheck(SpaceRocketSprite s) {
3132 int type = 0;
3233 try {
33- if(this.getBoundingRectangle().overlaps(s.getBoundingRectangle())) {
34+ if(Utility.intersects(this, s)) {
3435 type = this.type;
3536 this.reset();
3637 }
diff -r fe59f8dfa109 -r d48be19f1594 core/src/com/headwayent/spacerocket/old/RocketSprite.java
--- a/core/src/com/headwayent/spacerocket/old/RocketSprite.java Sun Dec 05 20:50:17 2021 +0200
+++ b/core/src/com/headwayent/spacerocket/old/RocketSprite.java Tue Dec 07 19:30:32 2021 +0200
@@ -5,15 +5,16 @@
55 import com.badlogic.gdx.graphics.g2d.TextureAtlas;
66 import com.badlogic.gdx.graphics.g2d.TextureRegion;
77 import com.headwayent.spacerocket.SpaceRocket;
8+import com.headwayent.spacerocket.Utility;
89
910 public class RocketSprite extends ExtendedSprite {
1011
1112 private boolean upDirection;
1213 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;
1718 public static int SR_SPEED;
1819 public static int ENEMY_SPEED;
1920
@@ -36,7 +37,7 @@
3637 System.out.println("RocketSprite s == null");
3738 }
3839 try {
39- if (getBoundingRectangle().overlaps(s.getBoundingRectangle())) {
40+ if (Utility.intersects(this, s)) {
4041 ret = true;
4142 s.reset();
4243 if (!doubleDamage) {
@@ -44,7 +45,7 @@
4445 }
4546 }
4647 } catch (Exception e) {
47- System.out.println("SpaceRocketSprite collision error");
48+ e.printStackTrace();
4849 }
4950 return ret;
5051 }
@@ -58,7 +59,7 @@
5859 if (upDirection) {
5960 speedY = SR_SPEED;
6061 } else {
61- speedY = SpaceRocket.getRandom().nextInt(ENEMY_SPEED) + (ENEMY_SPEED >> 2);
62+ speedY = SpaceRocket.getRandom().nextInt(ENEMY_SPEED) + (ENEMY_SPEED / 4);
6263 }
6364 setSpeed(0, speedY);
6465 // released = true;
@@ -75,20 +76,11 @@
7576 return upDirection;
7677 }
7778
78- /**
79- * @return the doubleDamage
80- */
8179 public boolean isDoubleDamage() {
8280 return doubleDamage;
8381 }
8482
85- /**
86- * @param doubleDamage the doubleDamage to set
87- */
8883 public void setDoubleDamage(boolean doubleDamage) {
8984 this.doubleDamage = doubleDamage;
9085 }
91- /* public void advance() {
92- move(speedX, speedY);
93- }*/
9486 }
diff -r fe59f8dfa109 -r d48be19f1594 core/src/com/headwayent/spacerocket/old/SpaceRocketSprite.java
--- a/core/src/com/headwayent/spacerocket/old/SpaceRocketSprite.java Sun Dec 05 20:50:17 2021 +0200
+++ b/core/src/com/headwayent/spacerocket/old/SpaceRocketSprite.java Tue Dec 07 19:30:32 2021 +0200
@@ -19,19 +19,19 @@
1919 public static int SR_ACC_SPEED;
2020 public static int SR_MAX_SPEED;
2121 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;
2424 private static final int _ROCKET_DISTANCE = -24;
2525 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;
2727 private static final int _ROCKET_DISTANCE_SM = -10;
2828 private static final int NUM_LIVES = 10;
2929 private static int MULTI_SHOOT_X_SPEED;
3030 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;
3535 public static final int STD_FRAME = 0;
3636 public static final int GIVE_LIFE_FRAME = 0;
3737 public static final int DOUBLE_DAMAGE_FRAME = 1;
@@ -39,8 +39,8 @@
3939 public static final int INVINCIBILITY_FRAME = 0;
4040 private static final int NUM_FRAMES = 3;
4141 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;
4444 private static int DOUBLE_DAMAGE_SPEED;
4545 private float speedX, speedY;
4646 private long currentDelay;
@@ -146,11 +146,11 @@
146146 return false;
147147 }
148148 try {
149- if (getBoundingRectangle().overlaps(s.getBoundingRectangle())) {
149+ if (Utility.intersects(this, s)) {
150150 ret = true;
151151 if (!(s instanceof BossSprite)) {
152152
153- s.resetExplode();
153+ s.resetWithExplosion();
154154 }
155155 if (Utility.hasTimePassed(currentInvincibilityTime, invincibilityTime)) {
156156 spPos.x = getX();
@@ -178,7 +178,7 @@
178178 return false;
179179 }
180180 try {
181- if (getBoundingRectangle().overlaps(s.getBoundingRectangle())) {
181+ if (Utility.intersects(this, s)) {
182182 ret = true;
183183 s.reset();
184184