-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameLevel.java
2152 lines (1804 loc) · 87 KB
/
GameLevel.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package mkat.apps.spacewars;
import java.io.IOException;
import java.util.Timer;
import java.util.TimerTask;
import org.andengine.audio.music.Music;
import org.andengine.audio.music.MusicFactory;
import org.andengine.audio.music.exception.MusicReleasedException;
import org.andengine.engine.camera.BoundCamera;
import org.andengine.engine.camera.hud.HUD;
import org.andengine.engine.handler.IUpdateHandler;
import org.andengine.engine.handler.timer.TimerHandler;
import org.andengine.entity.IEntity;
import org.andengine.entity.modifier.IEntityModifier.IEntityModifierListener;
import org.andengine.entity.modifier.MoveModifier;
import org.andengine.entity.particle.BatchedSpriteParticleSystem;
import org.andengine.entity.particle.emitter.CircleParticleEmitter;
import org.andengine.entity.particle.emitter.PointParticleEmitter;
import org.andengine.entity.particle.initializer.AccelerationParticleInitializer;
import org.andengine.entity.particle.initializer.BlendFunctionParticleInitializer;
import org.andengine.entity.particle.initializer.ExpireParticleInitializer;
import org.andengine.entity.particle.modifier.ScaleParticleModifier;
import org.andengine.entity.primitive.Line;
import org.andengine.entity.primitive.Rectangle;
import org.andengine.entity.scene.CameraScene;
import org.andengine.entity.scene.IOnSceneTouchListener;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.sprite.AnimatedSprite;
import org.andengine.entity.sprite.Sprite;
import org.andengine.entity.sprite.TiledSprite;
import org.andengine.entity.sprite.UncoloredSprite;
import org.andengine.entity.sprite.AnimatedSprite.IAnimationListener;
import org.andengine.entity.text.Text;
import org.andengine.extension.physics.box2d.PhysicsFactory;
import org.andengine.extension.physics.box2d.PhysicsWorld;
import org.andengine.input.touch.TouchEvent;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.util.math.MathUtils;
import org.andengine.util.modifier.IModifier;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.Shape;
import android.opengl.GLES20;
import android.util.Log;
public class GameLevel extends ManagedGameScene implements IOnSceneTouchListener{
//self reference this class (GameLevel)
private static final GameLevel INSTANCE = new GameLevel();
public static GameLevel getInstance(){
return INSTANCE;
}
public GameLevel() {
this.setOnSceneTouchListenerBindingOnActionDownEnabled(true);
this.setTouchAreaBindingOnActionDownEnabled(true);
this.setTouchAreaBindingOnActionMoveEnabled(true);
this.setOnSceneTouchListener(this);
}
//Global Variables
TimerHandler bulletTimerHandler;
BoundCamera gameCamera;
Text mScoreText;
Music mMusic;
boolean readyToFireLaser, fireRate, fireRateAttached, health, healthAttached, firePower, firePowerAttached, readyToFireEnemyLaser, playerHit, playerHitBoss = false;
Player mPlayer = null;
Boss mBoss1 = null;
TiledSprite mMuteButton = null;
Sprite waveNum, wav1, wav2, wav3, wav4, wav5, pause, lvl1Num, lvl2Num, lvl3Num, lvl4Num, lvl5Num, play, GameOver, levelNum, fireRatePickup, firePowerPickup, healthPickup, background, back1, back2, back3, back4, back5 = null;
ITextureRegion[] eTex;
PlayerLaser PlayerLaser = null;
Enemy[] mEnemyWave;
Pointer[] pointer;
BossPointer[] bossPointer;
PlusPointer[] pointerPlus;
Line plusPointerHealthLine, plusPointerPowerLine, plusPointerRateLine, bossPointerLine;
ITextureRegion bLaser1, boss1tex, boss2tex, boss3tex, boss4tex, boss5tex, bLaser2, pCurrentEnemyTexture, pGCTexture, pEnvFlames, pCurrentPlayerTexture, pPlayerLaserTexture, pPlayerLaserTexture2, pEnemyLaserTexture, pBossLaserTexture, pLvl1BossTexture, pFireRateTexture, pFirePowerTexture, pHealthTexture = null;// in case we need to allocate a new enemy from the pool after our pool is exhausted, we want the texture to be of the current enemy type (of the 5 possible).
EnemyPool enemyWave;
PointerPool pointerWave;
PlusPointerPool plusPointerWave;
BossPointerPool bossPointerWave;
Rectangle boundBox; //level 5 boss bounding box
float touchX;
float touchY;
float dToPlayer = 1000;
float dToPX;
float dToPY;
float fireRateDuration = 0;
float laserRotationAngle = 0;
float enemyX, enemyY, enemyX2, enemyY2 = 0; //used for laser fire
boolean PlayerReady, BossReady, LevelLoaded = false;
/*Move modifier variables
/*Define Move Modifiers*/
int counter, waveCounter, gameLevel, totalEnemiesInPool, enemyCount, Level = 0;
float duration = 0;
float distance;
float fromX;
float toX;
float fromY;
float toY;
float rotateX;
float rotateY;
float directionX;
float directionY;
float rotationAngle;
float fireRateEnemy, fireRateEnemyStart;
float widthX, heightY;
Timer t;
HUD hud;
AnimatedSprite animatedSprite;
int playerLife, bossLife = 0;
public CameraScene mPauseScene;
MoveModifier moveEnemy1, moveBoss1;
IEntityModifierListener entityModifierListener;
Sprite[] lifeBars;
//level5 boss
BatchedSpriteParticleSystem particleSystem;
CircleParticleEmitter particleEmitter;
//HUD Score
private static final String SCORE_STRING_PREFIX = "Score: ";
private static final String SCORE_FORMAT = "0000";
private static final int MAX_CHARACTER_COUNT = SCORE_STRING_PREFIX.length() + SCORE_FORMAT.length();
//Text mScoreText = null;
//Physics Collision Detection
//public FixedStepPhysicsWorld mPhysicsWorld;
//public Body[] dynamicEnemyBody;
//final FixtureDef boxFixtureDef = PhysicsFactory.createFixtureDef(20f, 0f, 0.5f);
//Body[] enemyBody;
//public boolean setHalfAlphaForStaticBody = false;
//enemy-on-enemy collisions
MoveModifier avoidCollideOtherEnemies;
//float duration = 0;
IEntityModifierListener entityListener;
public ManagedGameScene thisGameLevel = this;
public void loadLevel(int i) {
if (i == 1){
//THIS IS THE STUFF THAT CHANGES PER LEVEL
bossLife = 20; //per level
fireRateEnemy = 1f;
fireRateDuration = .5f;
fireRateEnemyStart = 5f;
waveCounter = 0; //per level
enemyCount = 0;
healthAttached = false; //should start as false every level
firePowerAttached = false; //should start as false every level
fireRateAttached = false; //should start as false every level
readyToFireLaser = false;
readyToFireEnemyLaser = false;
//BOSS TEXTURE
pLvl1BossTexture = boss1tex;
//pLvl1BossTexture = ResourceManager.getInstance().mBoss1TextureRegion;
//END BOSS TEXTURE
if (background != null && background.hasParent()){
background.detachSelf();
}
background = back1;
background.setCullingEnabled(true);
//SETUP BACKGROUND
thisGameLevel.attachChild(background);
//END SETUP BACKGROUND
//ResourceManager.getInstance().engine.getEngineOptions().getCamera().setBounds(1,1,1,1);
//BOSS LASER TEXTURE
pBossLaserTexture = bLaser1;
//END BOSS LASER TEXTURE
/*ResourceManager.getInstance().engine.runOnUpdateThread(new Runnable() {
@Override
public void run() {
for (int i3 = 0;i3<GameManager.getInstance().getLife();i3++){
//lifeBarWidth += ResourceManager.getInstance().mPlayerLifeTextureRegion.getWidth();
//lifeBars[i] = new Sprite((lifeBarWidth), ResourceManager.getInstance().cameraHeight - ResourceManager.getInstance().mPlayerLifeTextureRegion.getHeight(), ResourceManager.getInstance().mPlayerLifeTextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
if (GameLevel.getInstance().lifeBars[i3]!= null ){
if (GameLevel.getInstance().lifeBars[i3].hasParent()){
hud.detachChild(lifeBars[i3]);
}
}
}
GameManager.getInstance().zeroLife();
while (GameManager.getInstance().getLife()<10){
hud.attachChild(lifeBars[GameManager.getInstance().getLife()]);
GameManager.getInstance().incrementLife(1);
}
}
});*/
//ATTACH TO SCENE
//END ATTACH TO SCENE
//END THIS IS THE STUFF THAT CHANGES PER LEVEL
} else if (i == 2){
//THIS IS THE STUFF THAT CHANGES PER LEVEL
bossLife = 12; //per level
fireRateEnemy = 1f;
fireRateEnemyStart = 3f;
waveCounter = 0; //per level
fireRateDuration = .5f;
enemyCount = 0;
healthAttached = false; //should start as false every level
firePowerAttached = false; //should start as false every level
fireRateAttached = false; //should start as false every level
//give player full life
readyToFireLaser = false;
readyToFireEnemyLaser = false;
//end give players all life
//BOSS TEXTURE
pLvl1BossTexture = boss2tex;
//pLvl1BossTexture = ResourceManager.getInstance().mBoss1TextureRegion2;
//END BOSS TEXTURE
//BOSS LASER TEXTURE
pBossLaserTexture = bLaser2;
//END BOSS LASER TEXTURE
if (background != null && background.hasParent()){
background.detachSelf();
}
//SETUP BACKGROUND
background = back2;
background.setCullingEnabled(true);
//SETUP BACKGROUND
thisGameLevel.attachChild(background);
/*ResourceManager.getInstance().engine.runOnUpdateThread(new Runnable() {
@Override
public void run() {
for (int i3 = 0;i3<GameManager.getInstance().getLife();i3++){
//lifeBarWidth += ResourceManager.getInstance().mPlayerLifeTextureRegion.getWidth();
//lifeBars[i] = new Sprite((lifeBarWidth), ResourceManager.getInstance().cameraHeight - ResourceManager.getInstance().mPlayerLifeTextureRegion.getHeight(), ResourceManager.getInstance().mPlayerLifeTextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
if (GameLevel.getInstance().lifeBars[i3]!= null ){
if (GameLevel.getInstance().lifeBars[i3].hasParent()){
hud.detachChild(lifeBars[i3]);
}
}
}
GameManager.getInstance().zeroLife();
while (GameManager.getInstance().getLife()<10){
hud.attachChild(lifeBars[GameManager.getInstance().getLife()]);
GameManager.getInstance().incrementLife(1);
}
}
});*/
//END THIS IS THE STUFF THAT CHANGES PER LEVEL
}
else if (i == 3){
//THIS IS THE STUFF THAT CHANGES PER LEVEL
bossLife = 20; //per level
fireRateEnemy = 2f;
fireRateDuration = .5f;
fireRateEnemyStart = 2f;
waveCounter = 0; //per level
enemyCount = 0;
healthAttached = false; //should start as false every level
firePowerAttached = false; //should start as false every level
fireRateAttached = false; //should start as false every level
readyToFireLaser = false;
readyToFireEnemyLaser = false;
//BOSS TEXTURE
pLvl1BossTexture = boss3tex;
//pLvl1BossTexture = ResourceManager.getInstance().mBoss1TextureRegion3;
//END BOSS TEXTURE
//BOSS LASER TEXTURE
pBossLaserTexture = bLaser1;
//END BOSS LASER TEXTURE
if (background != null && background.hasParent()){
background.detachSelf();
}
//SETUP BACKGROUND
background = back3;
background.setCullingEnabled(true);
//SETUP BACKGROUND
thisGameLevel.attachChild(background);
/*ResourceManager.getInstance().engine.runOnUpdateThread(new Runnable() {
@Override
public void run() {
for (int i3 = 0;i3<GameManager.getInstance().getLife();i3++){
//lifeBarWidth += ResourceManager.getInstance().mPlayerLifeTextureRegion.getWidth();
//lifeBars[i] = new Sprite((lifeBarWidth), ResourceManager.getInstance().cameraHeight - ResourceManager.getInstance().mPlayerLifeTextureRegion.getHeight(), ResourceManager.getInstance().mPlayerLifeTextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
if (GameLevel.getInstance().lifeBars[i3]!= null ){
if (GameLevel.getInstance().lifeBars[i3].hasParent()){
hud.detachChild(lifeBars[i3]);
}
}
}
GameManager.getInstance().zeroLife();
while (GameManager.getInstance().getLife()<10){
hud.attachChild(lifeBars[GameManager.getInstance().getLife()]);
GameManager.getInstance().incrementLife(1);
}
}
});*/
//END THIS IS THE STUFF THAT CHANGES PER LEVEL
}
else if (i == 4){
//THIS IS THE STUFF THAT CHANGES PER LEVEL
bossLife = 20; //per level
fireRateEnemy = 1f;
fireRateDuration = .5f;
fireRateEnemyStart = 2f;
waveCounter = 0; //per level
enemyCount = 0;
healthAttached = false; //should start as false every level
firePowerAttached = false; //should start as false every level
fireRateAttached = false; //should start as false every level
readyToFireLaser = false;
readyToFireEnemyLaser = false;
//BOSS TEXTURE
pLvl1BossTexture = boss4tex;
//pLvl1BossTexture = ResourceManager.getInstance().mBoss1TextureRegion4;
//END BOSS TEXTURE
if (background != null && background.hasParent()){
background.detachSelf();
}
//BOSS LASER TEXTURE
pBossLaserTexture = bLaser1;
//END BOSS LASER TEXTURE
//SETUP BACKGROUND
background = back4;
background.setCullingEnabled(true);
//SETUP BACKGROUND
thisGameLevel.attachChild(background);
/*ResourceManager.getInstance().engine.runOnUpdateThread(new Runnable() {
@Override
public void run() {
for (int i3 = 0;i3<GameManager.getInstance().getLife();i3++){
//lifeBarWidth += ResourceManager.getInstance().mPlayerLifeTextureRegion.getWidth();
//lifeBars[i] = new Sprite((lifeBarWidth), ResourceManager.getInstance().cameraHeight - ResourceManager.getInstance().mPlayerLifeTextureRegion.getHeight(), ResourceManager.getInstance().mPlayerLifeTextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
if (GameLevel.getInstance().lifeBars[i3]!= null ){
if (GameLevel.getInstance().lifeBars[i3].hasParent()){
hud.detachChild(lifeBars[i3]);
}
}
}
GameManager.getInstance().zeroLife();
while (GameManager.getInstance().getLife()<10){
hud.attachChild(lifeBars[GameManager.getInstance().getLife()]);
GameManager.getInstance().incrementLife(1);
}
}
});*/
//END THIS IS THE STUFF THAT CHANGES PER LEVEL
}
else if (i == 5){
//THIS IS THE STUFF THAT CHANGES PER LEVEL
bossLife = 25; //per level
fireRateEnemy = 1f;
fireRateDuration = .5f;
fireRateEnemyStart = 2f;
waveCounter = 0; //per level
enemyCount = 0;
healthAttached = false; //should start as false every level
firePowerAttached = false; //should start as false every level
fireRateAttached = false; //should start as false every level
readyToFireLaser = false;
readyToFireEnemyLaser = false;
//BOSS TEXTURE
pLvl1BossTexture = boss5tex;
//END BOSS TEXTURE
//BOSS LASER TEXTURE
pBossLaserTexture = bLaser1;
//END BOSS LASER TEXTURE
//BOSS LASER TEXTURE
pEnvFlames = ResourceManager.getInstance().mEnvFlames;
//END BOSS LASER TEXTURE
if (background != null && background.hasParent()){
background.detachSelf();
}
//SETUP BACKGROUND
background = back5;
background.setCullingEnabled(true);
//SETUP BACKGROUND
thisGameLevel.attachChild(background);
/*ResourceManager.getInstance().engine.runOnUpdateThread(new Runnable() {
@Override
public void run() {
for (int i3 = 0;i3<GameManager.getInstance().getLife();i3++){
//lifeBarWidth += ResourceManager.getInstance().mPlayerLifeTextureRegion.getWidth();
//lifeBars[i] = new Sprite((lifeBarWidth), ResourceManager.getInstance().cameraHeight - ResourceManager.getInstance().mPlayerLifeTextureRegion.getHeight(), ResourceManager.getInstance().mPlayerLifeTextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
if (GameLevel.getInstance().lifeBars[i3]!= null ){
if (GameLevel.getInstance().lifeBars[i3].hasParent()){
hud.detachChild(lifeBars[i3]);
}
}
}
GameManager.getInstance().zeroLife();
while (GameManager.getInstance().getLife()<10){
hud.attachChild(lifeBars[GameManager.getInstance().getLife()]);
GameManager.getInstance().incrementLife(1);
}
}
});*/
//END THIS IS THE STUFF THAT CHANGES PER LEVEL
}
}
@Override
public void onLoadScene() {
super.onLoadScene();
duration = 30; //reset on enemy waves, leave it be
counter = 0; //handles enemy MoveModifier creation, leave it be
widthX = (1024/ResourceManager.getInstance().cameraWidth);
heightY = (640/ResourceManager.getInstance().cameraHeight);
gameCamera.setBounds(0,0,(widthX*ResourceManager.getInstance().cameraWidth),(heightY*ResourceManager.getInstance().cameraHeight));
mMusic = null;
playerLife = GameManager.getInstance().getLife(); //leave it be between levels
mMuteButton = null;
//BACKGROUND
back1 = new Sprite((widthX*ResourceManager.getInstance().cameraWidth)/2f, (heightY*ResourceManager.getInstance().cameraHeight)/2f, ResourceManager.getInstance().mGameBackgroundTextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
back2 = new Sprite((widthX*ResourceManager.getInstance().cameraWidth)/2f, (heightY*ResourceManager.getInstance().cameraHeight)/2f, ResourceManager.getInstance().mGameBackgroundTextureRegion2, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
back3 = new Sprite((widthX*ResourceManager.getInstance().cameraWidth)/2f, (heightY*ResourceManager.getInstance().cameraHeight)/2f, ResourceManager.getInstance().mGameBackgroundTextureRegion3, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
back4 = new Sprite((widthX*ResourceManager.getInstance().cameraWidth)/2f, (heightY*ResourceManager.getInstance().cameraHeight)/2f, ResourceManager.getInstance().mGameBackgroundTextureRegion4, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
back5 = new Sprite((widthX*ResourceManager.getInstance().cameraWidth)/2f, (heightY*ResourceManager.getInstance().cameraHeight)/2f, ResourceManager.getInstance().mGameBackgroundTextureRegion5, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
//BACKGROUND
//GameManager.getInstance().resetGame();
Log.v("","Player Life " + GameManager.getInstance().getLife());
//PLAYER TEXTURE
pCurrentPlayerTexture = ResourceManager.getInstance().mPlayerTextureRegion;
//END PLAYER TEXTURE
//PLAYER LASER TEXTURES
pPlayerLaserTexture = ResourceManager.getInstance().mPlayerLaserTextureRegion;
pPlayerLaserTexture2 = ResourceManager.getInstance().mPlayerLaserTextureRegion2;
//END PLAYER LASER TEXTURES
//ENEMY LASER TEXTURE
pEnemyLaserTexture = ResourceManager.getInstance().mEnemyLaserTextureRegion;
//END ENEMY LASER TEXTURE
//GAME COMPLETE TEXTURE
pGCTexture = ResourceManager.getInstance().mGCTextureRegion;
//END GAME TEXTURE
//FIRE RATE TEXTURE
pFireRateTexture = ResourceManager.getInstance().mFRPTextureRegion;
fireRatePickup = new Sprite((float)(0 + (int)(Math.random() * ((1024 - 0) + 1))),(float)(0 + (int)(Math.random() * ((640 - 0) + 1))), pFireRateTexture, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
fireRatePickup.setCullingEnabled(true);
fireRate = false;
//END FIRE RATE TEXTURE
//FIRE POWER TEXTURE
pFirePowerTexture = ResourceManager.getInstance().mFPPTextureRegion;
firePowerPickup = new Sprite((float)(0 + (int)(Math.random() * ((1024 - 0) + 1))),(float)(0 + (int)(Math.random() * ((640 - 0) + 1))), pFirePowerTexture, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
firePowerPickup.setCullingEnabled(true);
firePower = false;
//END FIRE POWER TEXTURE
//HEALTH TEXTURE
pHealthTexture = ResourceManager.getInstance().mHealthTextureRegion;
healthPickup = new Sprite((float)(0 + (int)(Math.random() * ((1024 - 0) + 1))),(float)(0 + (int)(Math.random() * ((640 - 0) + 1))), pHealthTexture, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
healthPickup.setCullingEnabled(true);
health = false;
//END HEALTH TEXTURE
//thisGameLevel.attachChild(mPlayer);
enemyWave = new EnemyPool();
pointerWave = new PointerPool();
//PAUSE
//pause button on HUD
pause = new Sprite((ResourceManager.getInstance().cameraWidth-(ResourceManager.getInstance().mMenuBackgroundSound.getWidth())-(ResourceManager.getInstance().mPause.getWidth()/2)), ResourceManager.getInstance().cameraHeight - (ResourceManager.getInstance().mPause.getHeight()/2), ResourceManager.getInstance().mPause, ResourceManager.getInstance().engine.getVertexBufferObjectManager()){
//Override the onAreaTouched() method allowing us to define custom actions
@Override
public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY){
/* IN the event the mute button is pressed down on... */
if (pSceneTouchEvent.isActionDown()){
UserData.getInstance(ResourceManager.getInstance().context).pauseGame(true);
return true;
}
return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
}
};
play = new Sprite(ResourceManager.getInstance().cameraWidth/3, ResourceManager.getInstance().cameraHeight - ResourceManager.getInstance().mPlay.getHeight(), ResourceManager.getInstance().mPlay, ResourceManager.getInstance().engine.getVertexBufferObjectManager()) {
//Override the onAreaTouched() method allowing us to define custom actions
@Override
public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY){
/* IN the event the mute button is pressed down on... */
if (pSceneTouchEvent.isActionDown()){
UserData.getInstance(ResourceManager.getInstance().context).unPauseGame();
Log.v("","UnPause Game!");
return true;
}
return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
}
};
mPauseScene = new CameraScene(ResourceManager.getInstance().engine.getCamera());
final int pauseX= (int) ((ResourceManager.getInstance().cameraWidth / 2) - (play.getWidth()/2));
final int pauseY= (int) ((ResourceManager.getInstance().cameraHeight / 2) - (play.getHeight()/2));
play.setPosition(pauseX, pauseY);
mPauseScene.registerTouchArea(play);
mPauseScene.attachChild(play);
mPauseScene.setBackgroundEnabled(false);
//Boss textures
boss1tex = ResourceManager.getInstance().mBoss1TextureRegion;
boss2tex = ResourceManager.getInstance().mBoss1TextureRegion2;
boss3tex = ResourceManager.getInstance().mBoss1TextureRegion3;
boss4tex = ResourceManager.getInstance().mBoss1TextureRegion4;
boss5tex = ResourceManager.getInstance().mBoss1TextureRegion5;
bLaser1 = ResourceManager.getInstance().mBossLaserTextureRegion;
bLaser2 = ResourceManager.getInstance().mBossLaser2TextureRegion;
//END PAUSE
Level = UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1);
LevelLoaded = false;
//Set up a HUD
hud = new HUD();
gameCamera.setHUD(hud);
//END HUD
pointerPlus = new PlusPointer[3];
mScoreText = new Text((ResourceManager.getInstance().cameraWidth/2f), ResourceManager.getInstance().cameraHeight - ResourceManager.getInstance().mFont.getLineHeight(), ResourceManager.getInstance().mFont, SCORE_STRING_PREFIX, MAX_CHARACTER_COUNT, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
int lifeBarWidth = 0;
lifeBars = new Sprite[GameManager.getInstance().getLife()];
for (int i3 = 0;i3<GameManager.getInstance().getLife();i3++){
lifeBarWidth += ResourceManager.getInstance().mPlayerLifeTextureRegion.getWidth();
lifeBars[i3] = new Sprite((lifeBarWidth), ResourceManager.getInstance().cameraHeight - ResourceManager.getInstance().mPlayerLifeTextureRegion.getHeight(), ResourceManager.getInstance().mPlayerLifeTextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
//thisGameLevel.attachChild(lifeBars[i3]);
hud.attachChild(lifeBars[i3]);
}
//MUTE UNMUTE BUTTON SETUP
if (mMuteButton != null) {
if (mMuteButton.hasParent()){
hud.detachChild(mMuteButton);
hud.unregisterTouchArea(mMuteButton);
}
}
// Create the music mute/unmute button
mMuteButton = new TiledSprite(ResourceManager.getInstance().cameraWidth-(ResourceManager.getInstance().mMenuBackgroundSound.getWidth()/2), ResourceManager.getInstance().cameraHeight-(ResourceManager.getInstance().mMenuBackgroundSound.getHeight()/2), ResourceManager.getInstance().mMenuBackgroundSound, ResourceManager.getInstance().engine.getVertexBufferObjectManager()) {
//Override the onAreaTouched() method allowing us to define custom actions
@Override
public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY){
/* IN the event the mute button is pressed down on... */
if (pSceneTouchEvent.isActionDown()){
Log.v("","Is mMusic Released" + mMusic.isReleased());
if (mMusic.isPlaying()) {
/*
* If music is playing, pause it and set tile index to MUTE
*/UserData.getInstance(ResourceManager.getInstance().context).setMusic(1, 0);
this.setCurrentTileIndex(ResourceManager.getInstance().MUTE);
mMusic.pause();
} else {
/*
* If music is paused, play it and set tile index to
* UNMUTE
*/UserData.getInstance(ResourceManager.getInstance().context).setMusic(1, 1);
this.setCurrentTileIndex(ResourceManager.getInstance().UNMUTE);
mMusic.play();
ResourceManager.getInstance().engine.start();
}
return true;
}
return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
}
};
/* Set teh current tile index to unmuted on application startup*/
if (UserData.getInstance(ResourceManager.getInstance().context).getMusic(1)== 1){
mMuteButton.setCurrentTileIndex(ResourceManager.getInstance().UNMUTE);
} else if (UserData.getInstance(ResourceManager.getInstance().context).getMusic(1)== 0){
mMuteButton.setCurrentTileIndex(ResourceManager.getInstance().MUTE);
}
hud.registerTouchArea(mMuteButton);
hud.attachChild(mMuteButton);
//MUTE UNMUTE BUTTON SETUP
//Pause button
if (pause != null) {
if (pause.hasParent()){
hud.detachChild(pause);
hud.unregisterTouchArea(pause);
}
}
//end pause button
hud.registerTouchArea(pause);
hud.attachChild(pause);
if (!mScoreText.hasParent()){
hud.attachChild(mScoreText);
}
//Wave Nums
wav1 = new Sprite(mScoreText.getX(), mScoreText.getY()-mScoreText.getHeight(), ResourceManager.getInstance().mWave1TextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
wav2 = new Sprite(mScoreText.getX(), mScoreText.getY()-mScoreText.getHeight(), ResourceManager.getInstance().mWave2TextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
wav3 = new Sprite(mScoreText.getX(), mScoreText.getY()-mScoreText.getHeight(), ResourceManager.getInstance().mWave3TextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
wav4 = new Sprite(mScoreText.getX(), mScoreText.getY()-mScoreText.getHeight(), ResourceManager.getInstance().mWave4TextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
wav5 = new Sprite(mScoreText.getX(), mScoreText.getY()-mScoreText.getHeight(), ResourceManager.getInstance().mWave5TextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
//End
//LEVEL NUMS
lvl1Num = new Sprite(mScoreText.getX(), mScoreText.getY()-mScoreText.getHeight()-wav1.getHeight(), ResourceManager.getInstance().mLevel1TextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
lvl2Num = new Sprite(mScoreText.getX(), mScoreText.getY()-mScoreText.getHeight()-wav2.getHeight(), ResourceManager.getInstance().mLevel2TextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
lvl3Num = new Sprite(mScoreText.getX(), mScoreText.getY()-mScoreText.getHeight()-wav3.getHeight(), ResourceManager.getInstance().mLevel3TextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
lvl4Num = new Sprite(mScoreText.getX(), mScoreText.getY()-mScoreText.getHeight()-wav4.getHeight(), ResourceManager.getInstance().mLevel4TextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
lvl5Num = new Sprite(mScoreText.getX(), mScoreText.getY()-mScoreText.getHeight()-wav5.getHeight(), ResourceManager.getInstance().mLevel5TextureRegion, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
//End
//Enemy Textures
eTex = new ITextureRegion[25];
eTex[0] = ResourceManager.getInstance().mEnemy1TextureRegion;
eTex[1] = ResourceManager.getInstance().mEnemy1TextureRegion2;
eTex[2] = ResourceManager.getInstance().mEnemy1TextureRegion3;
eTex[3] = ResourceManager.getInstance().mEnemy1TextureRegion4;
eTex[4] = ResourceManager.getInstance().mEnemy1TextureRegion5;
eTex[5] = ResourceManager.getInstance().mEnemy2TextureRegion;
eTex[6] = ResourceManager.getInstance().mEnemy2TextureRegion2;
eTex[7] = ResourceManager.getInstance().mEnemy2TextureRegion3;
eTex[8] = ResourceManager.getInstance().mEnemy2TextureRegion4;
eTex[9] = ResourceManager.getInstance().mEnemy2TextureRegion5;
eTex[10] = ResourceManager.getInstance().mEnemy3TextureRegion;
eTex[11] = ResourceManager.getInstance().mEnemy3TextureRegion2;
eTex[12] = ResourceManager.getInstance().mEnemy3TextureRegion3;
eTex[13] = ResourceManager.getInstance().mEnemy3TextureRegion4;
eTex[14] = ResourceManager.getInstance().mEnemy3TextureRegion5;
eTex[15] = ResourceManager.getInstance().mEnemy4TextureRegion;
eTex[16] = ResourceManager.getInstance().mEnemy4TextureRegion2;
eTex[17] = ResourceManager.getInstance().mEnemy4TextureRegion3;
eTex[18] = ResourceManager.getInstance().mEnemy4TextureRegion4;
eTex[19] = ResourceManager.getInstance().mEnemy4TextureRegion5;
eTex[20] = ResourceManager.getInstance().mEnemy5TextureRegion;
eTex[21] = ResourceManager.getInstance().mEnemy5TextureRegion2;
eTex[22] = ResourceManager.getInstance().mEnemy5TextureRegion3;
eTex[23] = ResourceManager.getInstance().mEnemy5TextureRegion4;
eTex[24] = ResourceManager.getInstance().mEnemy5TextureRegion5;
//end
thisGameLevel.registerUpdateHandler(new IUpdateHandler() {
@Override
public void onUpdate(float pSecondsElapsed) {
if (GameManager.getInstance().GetGMDone()) {
if (LevelLoaded == false){
loadLevel(Level);
//mMusic = new Music();
if (Level == 1) {
//mMusic.stop();
//mMusic.release();
Log.v("","Set music to level 1 music");
mMusic = ResourceManager.getInstance().mMusiclvl1;
mMusic.getMediaPlayer().seekTo(0);
if (UserData.getInstance(ResourceManager.getInstance().context).getMusic(1)==1){
mMusic.setLooping(true);
mMusic.play();
Log.v("","Level1 music should be playing");
} else if (UserData.getInstance(ResourceManager.getInstance().context).getMusic(1)==0){
mMusic.pause();
Log.v("","Level 1 music should be paused");
}
Log.v("","Is mMusic Released" + mMusic.isReleased());
}
else if (Level == 2) {
if (mMusic != null){
if (mMusic.isPlaying()) mMusic.stop();
}
mMusic = ResourceManager.getInstance().mMusiclvl2;
Log.v("","Set music to level 2 music");
mMusic.getMediaPlayer().seekTo(0);
if (UserData.getInstance(ResourceManager.getInstance().context).getMusic(1)==1){
mMusic.setLooping(true);
mMusic.play();
Log.v("","Level2 music should be playing");
} else if (UserData.getInstance(ResourceManager.getInstance().context).getMusic(1)==0){
mMusic.pause();
Log.v("","Level 2 music should be paused");
}
Log.v("","Is mMusic Released" + mMusic.isReleased());
}
else if (Level == 3) {
if (mMusic != null){
if (mMusic.isPlaying()) mMusic.stop();
}
mMusic = ResourceManager.getInstance().mMusiclvl3;
Log.v("","Set music to level 3 music");
mMusic.getMediaPlayer().seekTo(0);
if (UserData.getInstance(ResourceManager.getInstance().context).getMusic(1)==1){
mMusic.setLooping(true);
mMusic.play();
Log.v("","Level3 music should be playing");
} else if (UserData.getInstance(ResourceManager.getInstance().context).getMusic(1)==0){
mMusic.pause();
Log.v("","Level 3 music should be paused");
}
}
else if (Level == 4) {
if (mMusic != null){
if (mMusic.isPlaying()) mMusic.stop();
}
mMusic = ResourceManager.getInstance().mMusiclvl4;
Log.v("","Set music to level 4 music");
mMusic.getMediaPlayer().seekTo(0);
if (UserData.getInstance(ResourceManager.getInstance().context).getMusic(1)==1){
mMusic.setLooping(true);
mMusic.play();
Log.v("","Level4 music should be playing");
} else if (UserData.getInstance(ResourceManager.getInstance().context).getMusic(1)==0){
mMusic.pause();
Log.v("","Level 4 music should be paused");
}
}
else if (Level == 5) {
if (mMusic != null){
if (mMusic.isPlaying()) mMusic.stop();
}
//mMusic.release();
mMusic = ResourceManager.getInstance().mMusiclvl5;
Log.v("","Set music to level 5 music");
mMusic.getMediaPlayer().seekTo(0);
if (UserData.getInstance(ResourceManager.getInstance().context).getMusic(1)==1){
mMusic.setLooping(true);
mMusic.play();
Log.v("","Level5 music should be playing");
} else if (UserData.getInstance(ResourceManager.getInstance().context).getMusic(1)==0){
mMusic.pause();
Log.v("","Level5 music should be paused");
}
}
LevelLoaded = true;
mPlayer = new Player(pCurrentPlayerTexture);
GameLevel.getInstance().attachChild(mPlayer);
PlayerReady = true;
//mPlayer.setPosition(100, 100);
ResourceManager.getInstance().engine.getCamera().setChaseEntity(mPlayer); //set chase camera
}
//SETUP NEW WAVE OF ENEMIES
if (enemyCount == 0){
if (waveCounter == 0) {
//player.getX()-(ResourceManager.getInstance().cameraWidth/2), player.getY()-(ResourceManager.getInstance().cameraHeight/2),player.getX()-(ResourceManager.getInstance().cameraWidth/2),player.getY()+(ResourceManager.getInstance().cameraHeight/2)
waveNum = wav1;
hud.attachChild(waveNum);
if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 1){
levelNum = lvl1Num;
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 2){
levelNum = lvl2Num;
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 3){
levelNum = lvl3Num;
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 4){
levelNum = lvl4Num;
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 5){
levelNum = lvl5Num;
}
hud.attachChild(levelNum);
waveCounter++;
//ENEMY TEXTURE
//set the currentEnemyTexture - set this every time you change the enemy type (5 per level), 25 total.
if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 1){
pCurrentEnemyTexture = eTex[0];
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 2){
pCurrentEnemyTexture = eTex[1];
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 3){
pCurrentEnemyTexture = eTex[2];
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 4){
pCurrentEnemyTexture = eTex[3];
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 5){
pCurrentEnemyTexture = eTex[4];
}
//END ENEMY TEXTURE
//wait(2000);
duration = 30;
//enemyWave = new EnemyPool();
//pointerWave = new PointerPool();
totalEnemiesInPool = 5;
enemyCount = totalEnemiesInPool;
GameManager.getInstance().resetEnemyCount(enemyCount);
mEnemyWave = null;
mEnemyWave = new Enemy[totalEnemiesInPool];
pointer = new Pointer[totalEnemiesInPool];
//enemyBody = new Body[10];
//firstWave.batchAllocatePoolItems(10);
for (int i = 0; i<totalEnemiesInPool; i++){
mEnemyWave[i] = enemyWave.obtainPoolItem();
pointer[i] = pointerWave.obtainPoolItem(mEnemyWave[i]);
}
GameLevel.getInstance().mBoss1 = null;
//ResourceManager.getInstance().engine.unregisterUpdateHandler(GameLevel.getInstance().bulletTimerHandler);
//mPlayer.detachSelf();
t = new Timer();
t.schedule(new TimerTask() {
@Override
public void run() {
ResourceManager.getInstance().engine.runOnUpdateThread(new Runnable() {
@Override
public void run() {
Log.v("","TIMER TASK EXPIRES");
hud.detachChild(waveNum);
hud.detachChild(levelNum);
readyToFireLaser = true;
readyToFireEnemyLaser = true;
}
});
}
}, 5000);
}
else if (waveCounter == 1) {
waveNum = wav2;
hud.attachChild(waveNum);
waveCounter++;
//ENEMY TEXTURE
//set the currentEnemyTexture - set this every time you change the enemy type (5 per level), 25 total.
if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 1){
pCurrentEnemyTexture = eTex[5];
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 2){
pCurrentEnemyTexture = eTex[6];
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 3){
pCurrentEnemyTexture = eTex[7];
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 4){
pCurrentEnemyTexture = eTex[8];
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 5){
pCurrentEnemyTexture = eTex[9];
}
//END ENEMY TEXTURE
//wait(2000);
duration = 25;
//enemyWave = new EnemyPool();
//pointerWave = new PointerPool();
plusPointerWave = new PlusPointerPool();
totalEnemiesInPool = 5;
enemyCount = totalEnemiesInPool;
GameManager.getInstance().resetEnemyCount(enemyCount);
mEnemyWave = new Enemy[totalEnemiesInPool];
pointer = new Pointer[totalEnemiesInPool];
//enemyBody = new Body[10];
//firstWave.batchAllocatePoolItems(10);
for (int i = 0; i<totalEnemiesInPool; i++){
mEnemyWave[i] = enemyWave.obtainPoolItem();
pointer[i] = pointerWave.obtainPoolItem(mEnemyWave[i]);
}
//ResourceManager.getInstance().engine.unregisterUpdateHandler(GameLevel.getInstance().bulletTimerHandler);
//mPlayer.detachSelf();
t = new Timer();
t.schedule(new TimerTask() {
@Override
public void run() {
ResourceManager.getInstance().engine.runOnUpdateThread(new Runnable() {
@Override
public void run() {
Log.v("","TIMER TASK EXPIRES");
hud.detachChild(waveNum);
if (!firePowerPickup.hasParent()) {
thisGameLevel.attachChild(firePowerPickup);
firePowerAttached = true;
plusPointerPowerLine = new Line(firePowerPickup.getX(), firePowerPickup.getY(), mPlayer.getX(), mPlayer.getY(), ResourceManager.getInstance().engine.getVertexBufferObjectManager());
plusPointerPowerLine.setCullingEnabled(true);
pointerPlus[1] = plusPointerWave.obtainPoolItem(firePowerPickup, "FirePower");
//thisGameLevel.attachChild(plusPointerPowerLine);
//thisGameLevel.attachChild(plusPointerP);
}
if (!healthPickup.hasParent()) {
thisGameLevel.attachChild(healthPickup);
healthAttached = true;
//plusPointerH = new Sprite(GameLevel.getInstance().mPlayer.getX(),GameLevel.getInstance().mPlayer.getY(), ResourceManager.getInstance().mHealthPointer, ResourceManager.getInstance().engine.getVertexBufferObjectManager());
plusPointerHealthLine = new Line(healthPickup.getX(), healthPickup.getY(), mPlayer.getX(), mPlayer.getY(), ResourceManager.getInstance().engine.getVertexBufferObjectManager());
plusPointerHealthLine.setCullingEnabled(true);
pointerPlus[0] = plusPointerWave.obtainPoolItem(healthPickup, "Health");
//thisGameLevel.attachChild(plusPointerHealthLine);
Log.v("", "loaded healthPickup");
//thisGameLevel.attachChild(plusPointerH);
}
readyToFireLaser = true;
readyToFireEnemyLaser = true;
}
});
}
}, 2000);
}
else if (waveCounter == 2) {
waveNum = wav3;
hud.attachChild(waveNum);
waveCounter++;
//ENEMY TEXTURE
//set the currentEnemyTexture - set this every time you change the enemy type (5 per level), 25 total.
if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 1){
pCurrentEnemyTexture = eTex[10];
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 2){
pCurrentEnemyTexture = eTex[11];
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 3){
pCurrentEnemyTexture = eTex[12];
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 4){
pCurrentEnemyTexture = eTex[13];
} else if (UserData.getInstance(ResourceManager.getInstance().context).lastLevelUnLocked(1) == 5){
pCurrentEnemyTexture = eTex[14];
}
//END ENEMY TEXTURE
//wait(2000);
duration = 25;
//enemyWave = new EnemyPool();
//pointerWave = new PointerPool();
plusPointerWave = new PlusPointerPool();
totalEnemiesInPool = 5;
enemyCount = totalEnemiesInPool;
GameManager.getInstance().resetEnemyCount(enemyCount);
mEnemyWave = null;
mEnemyWave = new Enemy[totalEnemiesInPool];
pointer = new Pointer[totalEnemiesInPool];