Fixed wall bug, implemented IShoot enemy. Implemented next level transitions.

linux_template
sigonasr2 2 years ago
parent 8978130bd8
commit d3a918876c
  1. 31
      Faceball2030/Editor.cpp
  2. 14
      Faceball2030/Editor.h
  3. 4
      Faceball2030/assets/enemies/IShoot.mtl
  4. 1027
      Faceball2030/assets/enemies/IShoot.obj
  5. BIN
      Faceball2030/assets/enemies/IShoot.png
  6. BIN
      Faceball2030/assets/enemies/IShoot.wings
  7. 595
      Faceball2030/assets/enemies/ShootMe2.obj
  8. BIN
      Faceball2030/assets/enemies/ShootMe2.png
  9. BIN
      Faceball2030/assets/enemies/ShootMe2.wings
  10. BIN
      Faceball2030/assets/enemies/cone1_auv.png
  11. 93
      Faceball2030/assets/map/map2.map
  12. 106
      Faceball2030/main.cpp
  13. 42
      Faceball2030/main.h

@ -9,11 +9,40 @@ Editor::Editor() {
MAP_SIZE = { (int)map[0].size(),(int)map.size() };
}
std::string Editor::GetPowerupName(PowerupType type){
switch (type){
case PowerupType::ARMOR:{
return "ARMOR";
}break;
case PowerupType::CAMO:{
return "CAMO";
}break;
case PowerupType::COIN:{
return "COIN";
}break;
case PowerupType::MAP:{
return "MAP";
}break;
case PowerupType::SHIELD:{
return "SHIELD";
}break;
case PowerupType::SHOTS:{
return "SHOTS";
}break;
case PowerupType::SPEED:{
return "SPEED";
}break;
case PowerupType::STOP:{
return "STOP";
}break;
}
}
void Editor::Update(float fElapsedTime){
MouseWheelEnemySelection();
RenderLevel();
WaveLayerSelection();
game->DrawStringDecal({ 2,16 }, "Selected Enemy ("+std::to_string(selectedEnemy) + "): " + game->GetData(selectedEnemy).name, WHITE, {3,3});
game->DrawStringDecal({ 2,16 }, "Selected Enemy ("+std::to_string(selectedEnemy) + "): " + game->GetData(selectedEnemy).name + (game->GetData(selectedEnemy).powerupDrop!=PowerupType::NONE?"("+GetPowerupName(game->GetData(selectedEnemy).powerupDrop)+")":""), WHITE, {3,3});
game->DrawStringDecal({ 2,(float)game->ScreenHeight() - 50 }, "Layer " + std::to_string(waveLayer), WHITE, { 5,5 });
if (!game->IsTextEntryEnabled()) {
if (game->GetKey(F3).bPressed) {

@ -6,6 +6,18 @@ enum class FacingDirection {
NORTH, EAST, SOUTH, WEST
};
enum class PowerupType {
NONE,
ARMOR,
SPEED,
SHOTS,
STOP,
SHIELD,
CAMO,
MAP,
COIN
};
enum EnemyID {
NONE,
EXIT,
@ -15,6 +27,7 @@ enum EnemyID {
ISHOOT,
ISHOOT2,
SHOOTME_ARMOR,
ISHOOT_MAP,
SONAR,
POWERUP_ARMOR = 56,
POWERUP_SPEED = 57,
@ -76,6 +89,7 @@ class Editor {
void Update(float fElapsedTime);
std::vector<std::vector<Tile>> LoadLevel(int level);
void OnTextEntryComplete(const std::string& sText);
std::string GetPowerupName(PowerupType type);
private:
void LoadLevelHandling();
void MouseWheelEnemySelection();

@ -1,5 +1,5 @@
# Exported from Wings 3D 2.2.9
newmtl IShoot
newmtl cone1_auv
Ns 19.999999999999996
d 1.0
illum 2
@ -7,5 +7,5 @@ Kd 1.0 1.0 1.0
Ka 0.0 0.0 0.0
Ks 0.19 0.19 0.19
Ke 0.0 0.0 0.0
map_Kd IShoot.png
map_Kd cone1_auv.png

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

@ -0,0 +1,595 @@
# Exported from Wings 3D 2.2.9
mtllib IShoot.mtl
o sphere1
#129 vertices, 254 faces
v 0.12858163 0.45401388 1.3359904e-19
v 0.12611097 0.45401388 2.5085032e-2
v 0.11879394 0.45401388 4.9206061e-2
v 0.10691172 0.45401388 7.1436128e-2
v 9.0920945e-2 0.45401388 9.0920945e-2
v 7.1436128e-2 0.45401388 0.10691172
v 4.9206061e-2 0.45401388 0.11879394
v 2.5085032e-2 0.45401388 0.12611097
v -8.7613184e-19 0.45401388 0.12858163
v -2.5085032e-2 0.45401388 0.12611097
v -4.9206061e-2 0.45401388 0.11879394
v -7.1436128e-2 0.45401388 0.10691172
v -9.0920945e-2 0.45401388 9.0920945e-2
v -0.10691172 0.45401388 7.1436128e-2
v -0.11879394 0.45401388 4.9206061e-2
v -0.12611097 0.45401388 2.5085032e-2
v -0.12858163 0.45401388 1.5880308e-17
v -0.12611097 0.45401388 -2.5085032e-2
v -0.11879394 0.45401388 -4.9206061e-2
v -0.10691172 0.45401388 -7.1436128e-2
v -9.0920945e-2 0.45401388 -9.0920945e-2
v -7.1436128e-2 0.45401388 -0.10691172
v -4.9206061e-2 0.45401388 -0.11879394
v -2.5085032e-2 0.45401388 -0.12611097
v -3.2369549e-17 0.45401388 -0.12858163
v 2.5085032e-2 0.45401388 -0.12611097
v 4.9206061e-2 0.45401388 -0.11879394
v 7.1436128e-2 0.45401388 -0.10691172
v 9.0920945e-2 0.45401388 -9.0920945e-2
v 0.10691172 0.45401388 -7.1436128e-2
v 0.11879394 0.45401388 -4.9206061e-2
v 0.12611097 0.45401388 -2.5085032e-2
v 0.23758788 0.38117824 1.3359904e-19
v 0.23302269 0.38117824 4.6351096e-2
v 0.21950258 0.38117824 9.0920945e-2
v 0.19754710 0.38117824 0.13199675
v 0.16800000 0.38117824 0.16800000
v 0.13199675 0.38117824 0.19754710
v 9.0920945e-2 0.38117824 0.21950258
v 4.6351096e-2 0.38117824 0.23302269
v 5.7985756e-18 0.38117824 0.23758788
v -4.6351096e-2 0.38117824 0.23302269
v -9.0920945e-2 0.38117824 0.21950258
v -0.13199675 0.38117824 0.19754710
v -0.16800000 0.38117824 0.16800000
v -0.19754710 0.38117824 0.13199675
v -0.21950258 0.38117824 9.0920945e-2
v -0.23302269 0.38117824 4.6351096e-2
v -0.23758788 0.38117824 2.9229723e-17
v -0.23302269 0.38117824 -4.6351096e-2
v -0.21950258 0.38117824 -9.0920945e-2
v -0.19754710 0.38117824 -0.13199675
v -0.16800000 0.38117824 -0.16800000
v -0.13199675 0.38117824 -0.19754710
v -9.0920945e-2 0.38117824 -0.21950258
v -4.6351096e-2 0.38117824 -0.23302269
v -5.2393671e-17 0.38117824 -0.23758788
v 4.6351096e-2 0.38117824 -0.23302269
v 9.0920945e-2 0.38117824 -0.21950258
v 0.13199675 0.38117824 -0.19754710
v 0.16800000 0.38117824 -0.16800000
v 0.19754710 0.38117824 -0.13199675
v 0.21950258 0.38117824 -9.0920945e-2
v 0.23302269 0.38117824 -4.6351096e-2
v 0.31042352 0.27217199 1.3359904e-19
v 0.30445882 0.27217199 6.0560625e-2
v 0.28679394 0.27217199 0.11879394
v 0.25810773 0.27217199 0.17246207
v 0.21950258 0.27217199 0.21950258
v 0.17246207 0.27217199 0.25810773
v 0.11879394 0.27217199 0.28679394
v 6.0560625e-2 0.27217199 0.30445882
v 1.0258473e-17 0.27217199 0.31042352
v -6.0560625e-2 0.27217199 0.30445882
v -0.11879394 0.27217199 0.28679394
v -0.17246207 0.27217199 0.25810773
v -0.21950258 0.27217199 0.21950258
v -0.25810773 0.27217199 0.17246207
v -0.28679394 0.27217199 0.11879394
v -0.30445882 0.27217199 6.0560625e-2
v -0.31042352 0.27217199 3.8149516e-17
v -0.30445882 0.27217199 -6.0560625e-2
v -0.28679394 0.27217199 -0.11879394
v -0.25810773 0.27217199 -0.17246207
v -0.21950258 0.27217199 -0.21950258
v -0.17246207 0.27217199 -0.25810773
v -0.11879394 0.27217199 -0.28679394
v -6.0560625e-2 0.27217199 -0.30445882
v -6.5773362e-17 0.27217199 -0.31042352
v 6.0560625e-2 0.27217199 -0.30445882
v 0.11879394 0.27217199 -0.28679394
v 0.17246207 0.27217199 -0.25810773
v 0.21950258 0.27217199 -0.21950258
v 0.25810773 0.27217199 -0.17246207
v 0.28679394 0.27217199 -0.11879394
v 0.30445882 0.27217199 -6.0560625e-2
v 0.33600000 1.1788256e-2 1.3359904e-19
v 0.32954385 1.1788256e-2 6.5550348e-2
v 0.31042352 1.1788256e-2 0.12858163
v 0.27937379 1.1788256e-2 0.18667160
v 0.23758788 1.1788256e-2 0.23758788
v 0.18667160 1.1788256e-2 0.27937379
v 0.12858163 1.1788256e-2 0.31042352
v 6.5550348e-2 1.1788256e-2 0.32954385
v 1.1824580e-17 1.1788256e-2 0.33600000
v -6.5550348e-2 1.1788256e-2 0.32954385
v -0.12858163 1.1788256e-2 0.31042352
v -0.18667160 1.1788256e-2 0.27937379
v -0.23758788 1.1788256e-2 0.23758788
v -0.27937379 1.1788256e-2 0.18667160
v -0.31042352 1.1788256e-2 0.12858163
v -0.32954385 1.1788256e-2 6.5550348e-2
v -0.33600000 1.1788256e-2 4.1281731e-17
v -0.32954385 1.1788256e-2 -6.5550348e-2
v -0.31042352 1.1788256e-2 -0.12858163
v -0.27937379 1.1788256e-2 -0.18667160
v -0.23758788 1.1788256e-2 -0.23758788
v -0.18667160 1.1788256e-2 -0.27937379
v -0.12858163 1.1788256e-2 -0.31042352
v -6.5550348e-2 1.1788256e-2 -0.32954385
v -7.0471685e-17 1.1788256e-2 -0.33600000
v 6.5550348e-2 1.1788256e-2 -0.32954385
v 0.12858163 1.1788256e-2 -0.31042352
v 0.18667160 1.1788256e-2 -0.27937379
v 0.23758788 1.1788256e-2 -0.23758788
v 0.27937379 1.1788256e-2 -0.18667160
v 0.31042352 1.1788256e-2 -0.12858163
v 0.32954385 1.1788256e-2 -6.5550348e-2
v -8.7494861e-18 0.47959036 1.3359904e-19
vt 0.0000000e+0 0.19631322
vt 0.0000000e+0 0.40195081
vt 0.0000000e+0 0.64275709
vt 3.7721035e-3 0.15801441
vt 3.7721035e-3 0.23461203
vt 1.4943454e-2 0.12118740
vt 1.4943454e-2 0.27143904
vt 1.6760480e-2 0.79579376
vt 1.6760480e-2 0.55498748
vt 3.3084743e-2 8.7247438e-2
vt 3.3084743e-2 0.30537900
vt 3.8432669e-2 0.87423899
vt 3.8432669e-2 0.63343272
vt 3.8565900e-2 0.63890696
vt 3.8565900e-2 0.39810068
vt 5.2106623e-2 0.79056028
vt 5.2106623e-2 0.54975400
vt 5.7498811e-2 5.7498811e-2
vt 5.7498811e-2 0.33512763
vt 6.6679363e-2 0.86806867
vt 6.6679363e-2 0.62726240
vt 7.7182532e-2 0.63599744
vt 7.7182532e-2 0.39519116
vt 8.6610534e-2 0.78686250
vt 8.6610534e-2 0.54605623
vt 8.7247438e-2 0.35954170
vt 8.7247438e-2 3.3084743e-2
vt 9.5576187e-2 0.86414794
vt 9.5576187e-2 0.62334167
vt 0.11584726 0.63414981
vt 0.11584726 0.39334353
vt 0.12067916 0.78466943
vt 0.12067916 0.54386316
vt 0.12118740 0.37768299
vt 0.12118740 1.4943454e-2
vt 0.12493116 0.86202745
vt 0.12493116 0.62122117
vt 0.15456859 0.78394568
vt 0.15456859 0.86147018
vt 0.15456859 0.63343272
vt 0.15456859 0.62066390
vt 0.15456859 0.54313940
vt 0.15456859 0.39262644
vt 0.15801441 0.38885434
vt 0.15801441 3.7721035e-3
vt 0.18420602 0.86202745
vt 0.18420602 0.62122117
vt 0.18845802 0.78466943
vt 0.18845802 0.54386316
vt 0.19328993 0.63414981
vt 0.19328993 0.39334353
vt 0.19631322 0.39262644
vt 0.19631322 0.0000000e+0
vt 0.21356100 0.62334167
vt 0.21356100 0.86414794
vt 0.22252665 0.78686250
vt 0.22252665 0.54605623
vt 0.23195465 0.63599744
vt 0.23195465 0.39519116
vt 0.23461203 0.38885434
vt 0.23461203 3.7721035e-3
vt 0.24245782 0.62726240
vt 0.24245782 0.86806867
vt 0.25703056 0.79056028
vt 0.25703056 0.54975400
vt 0.27057128 0.63890696
vt 0.27057128 0.39810068
vt 0.27070451 0.63343272
vt 0.27070451 0.87423899
vt 0.27143904 0.37768299
vt 0.27143904 1.4943454e-2
vt 0.29237670 0.79579376
vt 0.29237670 0.55498748
vt 0.30537900 0.35954170
vt 0.30537900 3.3084743e-2
vt 0.30913718 0.64275709
vt 0.30913718 0.40195081
vt 0.33512763 0.33512763
vt 0.33512763 5.7498811e-2
vt 0.35954170 0.30537900
vt 0.35954170 8.7247438e-2
vt 0.37768299 0.27143904
vt 0.37768299 0.12118740
vt 0.38885434 0.23461203
vt 0.38885434 0.15801441
vt 0.39262644 9.3243714e-3
vt 0.39262644 0.19631322
vt 0.39262644 0.25013065
vt 0.40938692 0.16236104
vt 0.40938692 0.40316732
vt 0.43105911 0.48161255
vt 0.43105911 0.24080628
vt 0.43119234 5.4742437e-3
vt 0.43119234 0.24628052
vt 0.44473306 0.15712756
vt 0.44473306 0.39793384
vt 0.45930580 0.47544223
vt 0.45930580 0.23463596
vt 0.46980897 0.24337100
vt 0.46980897 2.5647226e-3
vt 0.47923697 0.15342979
vt 0.47923697 0.39423607
vt 0.48820263 0.47152150
vt 0.48820263 0.23071523
vt 0.50847370 0.24152337
vt 0.50847370 7.1709317e-4
vt 0.51330560 0.39204299
vt 0.51330560 0.15123672
vt 0.51755760 0.46940101
vt 0.51755760 0.22859473
vt 0.54719503 0.39131924
vt 0.54719503 0.15051296
vt 0.54719503 0.22803746
vt 0.54719503 0.24080628
vt 0.54719503 0.46884374
vt 0.54719503 0.0000000e+0
vt 0.57683246 0.22859473
vt 0.57683246 0.46940101
vt 0.58108446 0.39204299
vt 0.58108446 0.15123672
vt 0.58591636 0.24152337
vt 0.58591636 7.1709317e-4
vt 0.60618743 0.23071523
vt 0.60618743 0.47152150
vt 0.61515309 0.15342979
vt 0.61515309 0.39423607
vt 0.62458109 0.24337100
vt 0.62458109 2.5647226e-3
vt 0.63508426 0.23463596
vt 0.63508426 0.47544223
vt 0.64965700 0.15712756
vt 0.64965700 0.39793384
vt 0.66319772 0.24628052
vt 0.66319772 5.4742437e-3
vt 0.66333095 0.24080628
vt 0.66333095 0.48161255
vt 0.68500314 0.16236104
vt 0.68500314 0.40316732
vt 0.70176362 0.25013065
vt 0.70176362 9.3243714e-3
vt 0.70176362 0.14760339
vt 0.70460960 0.17670010
vt 0.70463677 0.11843187
vt 0.71303301 0.20463292
vt 0.71316572 9.0285897e-2
vt 0.72669211 0.23036134
vt 0.72744227 6.4573667e-2
vt 0.74505709 0.25292950
vt 0.74639130 4.2209259e-2
vt 0.76742878 0.27149969
vt 0.76926669 2.4003898e-2
vt 0.77927928 0.14802626
vt 0.78057778 0.16199663
vt 0.78073783 0.13406754
vt 0.78457587 0.17544060
vt 0.78490592 0.12066329
vt 0.79111448 0.18784396
vt 0.79163105 0.10834178
vt 0.79296340 0.28538179
vt 0.79518773 1.0613758e-2
vt 0.79993963 0.19873453
vt 0.80063998 9.7580169e-2
vt 0.81071226 0.20769888
vt 0.81157598 8.8790328e-2
vt 0.82070251 0.29405771
vt 0.82302091 0.21439704
vt 0.82316940 2.5175483e-3
vt 0.82401266 8.2305431e-2
vt 0.83639685 0.21857466
vt 0.83747008 7.8369108e-2
vt 0.84960704 0.29719973
vt 0.85033122 0.22007215
vt 0.85088181 0.14859987
vt 0.85143240 7.7127582e-2
vt 0.85215658 0.0000000e+0
vt 0.86429354 0.21883062
vt 0.86536678 7.8625073e-2
vt 0.87775096 0.21489430
vt 0.87859422 0.29468218
vt 0.87874271 8.2802689e-2
vt 0.88106111 3.1420184e-3
vt 0.89018764 0.20840940
vt 0.89105136 8.9500853e-2
vt 0.90112364 0.19961956
vt 0.90182399 9.8465201e-2
vt 0.90657589 0.28658597
vt 0.90880022 1.1817936e-2
vt 0.91013258 0.18885795
vt 0.91064915 0.10935577
vt 0.91685770 0.17653644
vt 0.91718775 0.12175913
vt 0.92102579 0.16313219
vt 0.92118584 0.13520310
vt 0.92248434 0.14917347
vt 0.93249693 0.27319583
vt 0.93433484 2.5700039e-2
vt 0.95537232 0.25499047
vt 0.95670653 4.4270228e-2
vt 0.97432135 0.23262606
vt 0.97507151 6.6838391e-2
vt 0.98859790 0.20691383
vt 0.98873061 9.2566805e-2
vt 0.99712686 0.17876786
vt 0.99715402 0.12049963
vt 1.00000000 0.14959634
g sphere1
usemtl IShoot
s 1
f 1/194/ 34/204/ 33/205/
f 1/194/ 64/203/ 32/192/
f 1/194/ 129/173/ 2/193/
f 2/193/ 34/204/ 1/194/
f 2/193/ 129/173/ 3/191/
f 3/191/ 34/204/ 2/193/
f 3/191/ 36/200/ 35/202/
f 3/191/ 129/173/ 4/189/
f 4/189/ 36/200/ 3/191/
f 4/189/ 129/173/ 5/185/
f 5/185/ 36/200/ 4/189/
f 5/185/ 38/196/ 37/198/
f 5/185/ 129/173/ 6/183/
f 6/183/ 38/196/ 5/185/
f 6/183/ 129/173/ 7/180/
f 7/180/ 38/196/ 6/183/
f 7/180/ 40/181/ 39/187/
f 7/180/ 129/173/ 8/177/
f 8/177/ 40/181/ 7/180/
f 8/177/ 129/173/ 9/174/
f 9/174/ 40/181/ 8/177/
f 9/174/ 42/167/ 41/175/
f 9/174/ 129/173/ 10/170/
f 10/170/ 42/167/ 9/174/
f 10/170/ 129/173/ 11/168/
f 11/168/ 42/167/ 10/170/
f 11/168/ 44/151/ 43/160/
f 11/168/ 129/173/ 12/164/
f 12/164/ 44/151/ 11/168/
f 12/164/ 129/173/ 13/162/
f 13/162/ 44/151/ 12/164/
f 13/162/ 46/147/ 45/149/
f 13/162/ 129/173/ 14/158/
f 14/158/ 46/147/ 13/162/
f 14/158/ 129/173/ 15/156/
f 15/156/ 46/147/ 14/158/
f 15/156/ 48/143/ 47/145/
f 15/156/ 129/173/ 16/154/
f 16/154/ 48/143/ 15/156/
f 16/154/ 129/173/ 17/152/
f 17/152/ 48/143/ 16/154/
f 17/152/ 50/142/ 49/141/
f 17/152/ 129/173/ 18/153/
f 18/153/ 50/142/ 17/152/
f 18/153/ 129/173/ 19/155/
f 19/155/ 50/142/ 18/153/
f 19/155/ 52/146/ 51/144/
f 19/155/ 129/173/ 20/157/
f 20/157/ 52/146/ 19/155/
f 20/157/ 129/173/ 21/161/
f 21/161/ 52/146/ 20/157/
f 21/161/ 54/150/ 53/148/
f 21/161/ 129/173/ 22/163/
f 22/163/ 54/150/ 21/161/
f 22/163/ 129/173/ 23/166/
f 23/166/ 54/150/ 22/163/
f 23/166/ 56/165/ 55/159/
f 23/166/ 129/173/ 24/169/
f 24/169/ 56/165/ 23/166/
f 24/169/ 129/173/ 25/172/
f 25/172/ 56/165/ 24/169/
f 25/172/ 58/179/ 57/171/
f 25/172/ 129/173/ 26/176/
f 26/176/ 58/179/ 25/172/
f 26/176/ 129/173/ 27/178/
f 27/178/ 58/179/ 26/176/
f 27/178/ 60/195/ 59/186/
f 27/178/ 129/173/ 28/182/
f 28/182/ 60/195/ 27/178/
f 28/182/ 129/173/ 29/184/
f 29/184/ 60/195/ 28/182/
f 29/184/ 62/199/ 61/197/
f 29/184/ 129/173/ 30/188/
f 30/188/ 62/199/ 29/184/
f 30/188/ 129/173/ 31/190/
f 31/190/ 62/199/ 30/188/
f 31/190/ 64/203/ 63/201/
f 31/190/ 129/173/ 32/192/
f 32/192/ 64/203/ 31/190/
f 32/192/ 129/173/ 1/194/
f 33/205/ 64/203/ 1/194/
f 33/113/ 65/112/ 64/117/
f 34/110/ 65/112/ 33/113/
f 34/110/ 67/101/ 66/108/
f 35/202/ 34/204/ 3/191/
f 35/104/ 67/101/ 34/110/
f 36/98/ 67/101/ 35/104/
f 36/98/ 69/89/ 68/95/
f 37/198/ 36/200/ 5/185/
f 37/92/ 69/89/ 36/98/
f 38/130/ 69/138/ 37/136/
f 38/130/ 71/126/ 70/132/
f 39/187/ 38/196/ 7/180/
f 39/124/ 71/126/ 38/130/
f 40/118/ 71/126/ 39/124/
f 40/118/ 73/111/ 72/119/
f 41/175/ 40/181/ 9/174/
f 41/115/ 73/111/ 40/118/
f 42/109/ 73/111/ 41/115/
f 42/109/ 75/102/ 74/107/
f 43/160/ 42/167/ 11/168/
f 43/103/ 75/102/ 42/109/
f 44/97/ 75/102/ 43/103/
f 44/97/ 77/90/ 76/96/
f 45/149/ 44/151/ 13/162/
f 45/91/ 77/90/ 44/97/
f 46/63/ 77/72/ 45/69/
f 46/63/ 79/56/ 78/64/
f 47/145/ 46/147/ 15/156/
f 47/55/ 79/56/ 46/63/
f 48/46/ 79/56/ 47/55/
f 48/46/ 81/38/ 80/48/
f 49/141/ 48/143/ 17/152/
f 49/39/ 81/38/ 48/46/
f 50/36/ 81/38/ 49/39/
f 50/36/ 83/24/ 82/32/
f 51/144/ 50/142/ 19/155/
f 51/28/ 83/24/ 50/36/
f 52/20/ 83/24/ 51/28/
f 52/20/ 85/8/ 84/16/
f 53/148/ 52/146/ 21/161/
f 53/12/ 85/8/ 52/20/
f 54/62/ 85/73/ 53/68/
f 54/62/ 87/57/ 86/65/
f 55/159/ 54/150/ 23/166/
f 55/54/ 87/57/ 54/62/
f 56/47/ 87/57/ 55/54/
f 56/47/ 89/42/ 88/49/
f 57/171/ 56/165/ 25/172/
f 57/41/ 89/42/ 56/47/
f 58/37/ 89/42/ 57/41/
f 58/37/ 91/25/ 90/33/
f 59/186/ 58/179/ 27/178/
f 59/29/ 91/25/ 58/37/
f 60/21/ 91/25/ 59/29/
f 60/21/ 93/9/ 92/17/
f 61/197/ 60/195/ 29/184/
f 61/13/ 93/9/ 60/21/
f 62/129/ 93/137/ 61/135/
f 62/129/ 95/125/ 94/131/
f 63/201/ 62/199/ 31/190/
f 63/123/ 95/125/ 62/129/
f 64/117/ 65/112/ 96/120/
f 64/117/ 95/125/ 63/123/
f 65/112/ 98/106/ 97/116/
f 65/112/ 128/122/ 96/120/
f 66/108/ 65/112/ 34/110/
f 66/108/ 98/106/ 65/112/
f 67/101/ 98/106/ 66/108/
f 67/101/ 100/93/ 99/100/
f 68/95/ 67/101/ 36/98/
f 68/95/ 100/93/ 67/101/
f 69/89/ 100/93/ 68/95/
f 69/138/ 102/133/ 101/139/
f 70/132/ 69/138/ 38/130/
f 70/132/ 102/133/ 69/138/
f 71/126/ 102/133/ 70/132/
f 71/126/ 104/121/ 103/127/
f 72/119/ 71/126/ 40/118/
f 72/119/ 104/121/ 71/126/
f 73/111/ 104/121/ 72/119/
f 73/111/ 106/105/ 105/114/
f 74/107/ 73/111/ 42/109/
f 74/107/ 106/105/ 73/111/
f 75/102/ 106/105/ 74/107/
f 75/102/ 108/94/ 107/99/
f 76/96/ 75/102/ 44/97/
f 76/96/ 108/94/ 75/102/
f 77/90/ 108/94/ 76/96/
f 77/72/ 110/66/ 109/76/
f 78/64/ 77/72/ 46/63/
f 78/64/ 110/66/ 77/72/
f 79/56/ 110/66/ 78/64/
f 79/56/ 112/50/ 111/58/
f 80/48/ 79/56/ 48/46/
f 80/48/ 112/50/ 79/56/
f 81/38/ 112/50/ 80/48/
f 81/38/ 114/30/ 113/40/
f 82/32/ 81/38/ 50/36/
f 82/32/ 114/30/ 81/38/
f 83/24/ 114/30/ 82/32/
f 83/24/ 116/14/ 115/22/
f 84/16/ 83/24/ 52/20/
f 84/16/ 116/14/ 83/24/
f 85/8/ 116/14/ 84/16/
f 85/73/ 118/67/ 117/77/
f 86/65/ 85/73/ 54/62/
f 86/65/ 118/67/ 85/73/
f 87/57/ 118/67/ 86/65/
f 87/57/ 120/51/ 119/59/
f 88/49/ 87/57/ 56/47/
f 88/49/ 120/51/ 87/57/
f 89/42/ 120/51/ 88/49/
f 89/42/ 122/31/ 121/43/
f 90/33/ 89/42/ 58/37/
f 90/33/ 122/31/ 89/42/
f 91/25/ 122/31/ 90/33/
f 91/25/ 124/15/ 123/23/
f 92/17/ 91/25/ 60/21/
f 92/17/ 124/15/ 91/25/
f 93/9/ 124/15/ 92/17/
f 93/137/ 126/134/ 125/140/
f 94/131/ 93/137/ 62/129/
f 94/131/ 126/134/ 93/137/
f 95/125/ 126/134/ 94/131/
f 95/125/ 128/122/ 127/128/
f 96/120/ 95/125/ 64/117/
f 96/120/ 128/122/ 95/125/
f 97/116/ 128/122/ 65/112/
f 98/4/ 128/5/ 97/1/
f 99/100/ 98/106/ 67/101/
f 99/6/ 127/7/ 98/4/
f 100/10/ 126/11/ 99/6/
f 101/86/ 100/93/ 69/89/
f 101/18/ 125/19/ 100/10/
f 102/27/ 124/26/ 101/18/
f 103/127/ 102/133/ 71/126/
f 103/35/ 123/34/ 102/27/
f 104/45/ 122/44/ 103/35/
f 105/114/ 104/121/ 73/111/
f 105/53/ 121/52/ 104/45/
f 106/61/ 120/60/ 105/53/
f 107/99/ 106/105/ 75/102/
f 107/71/ 119/70/ 106/61/
f 108/75/ 118/74/ 107/71/
f 109/88/ 108/94/ 77/90/
f 109/79/ 117/78/ 108/75/
f 110/81/ 116/80/ 109/79/
f 111/58/ 110/66/ 79/56/
f 111/83/ 115/82/ 110/81/
f 112/85/ 114/84/ 111/83/
f 113/40/ 112/50/ 81/38/
f 113/87/ 114/84/ 112/85/
f 115/82/ 111/83/ 114/84/
f 115/22/ 114/30/ 83/24/
f 116/80/ 110/81/ 115/82/
f 117/78/ 109/79/ 116/80/
f 117/3/ 116/14/ 85/8/
f 118/74/ 108/75/ 117/78/
f 119/70/ 107/71/ 118/74/
f 119/59/ 118/67/ 87/57/
f 120/60/ 106/61/ 119/70/
f 121/52/ 105/53/ 120/60/
f 121/43/ 120/51/ 89/42/
f 122/44/ 104/45/ 121/52/
f 123/34/ 103/35/ 122/44/
f 123/23/ 122/31/ 91/25/
f 124/26/ 102/27/ 123/34/
f 125/19/ 101/18/ 124/26/
f 125/2/ 124/15/ 93/9/
f 126/11/ 100/10/ 125/19/
f 127/7/ 99/6/ 126/11/
f 127/128/ 126/134/ 95/125/
f 128/5/ 98/4/ 127/7/

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

@ -1,27 +1,66 @@
5
5
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8
8
8873
8204
8857
8200
8200
25244
8201
25260
8193
8196
8193
8192
16928
8196
16913
8196
16913
16944
8192
9280
8192
25280
8192
8196
8193
8192
8192
8194
8192
8192
8192
532
8193
8196
8197
8351
8193
8196
8193
8196
8193
8196
8195
8202
8194
406
8193
8196
529
8192
8472
8200
8744
8200
8192
8196
707
8194
8194
8194
8194
8194
25138
710

@ -67,7 +67,7 @@ bool Enemy::CanShoot() {
void Enemy::ShootBullet(int myIndex) {
fireDelay = game->enemyData[GetID()].fireDelay;
game->bullets.push_back({ game->bullet, pos,rot,0.2f,{std::cosf(rot) * game->shotSpd,std::sinf(rot) * game->shotSpd }, YELLOW,false,GetID(),myIndex,blinking});
game->bullets.push_back({ game->bullet, {pos.x,pos.y+0.15f,pos.z},rot,0.2f,{std::cosf(rot) * game->shotSpd,std::sinf(rot) * game->shotSpd }, YELLOW,false,GetID(),myIndex,blinking});
}
void Enemy::ReloadBullet(float fElapsedTime) {
@ -97,6 +97,11 @@ void Enemy::setExploded(bool exploded) {
this->exploded = exploded;
}
Enemy Enemy::freshCopy(bool randomizeLoc){
vf2d newPos = game->GetRandomizedSpawnPosition();
return Enemy{id,(randomizeLoc)?vec3d{newPos.x,0,newPos.y}:pos,rot,radius};
}
bool Enemy::isBlinking() {
return blinking;
}
@ -247,9 +252,11 @@ void FaceBall::InitializeEnemyData() {
enemyData[EnemyID::NONE] = { "VOID",undefined,BLACK };
enemyData[EXIT] = { "EXIT",undefined,GREEN };
enemyData[START] = { "SPAWN POSITION",undefined,{128,64,0} };
enemyData[SHOOTME] = { "SHOOTME",enemy_ShootMe,YELLOW,1,1,PI / 8,2,1,0.2f,true };
enemyData[SHOOTME2] = { "SHOOTME2",enemy_IShoot,YELLOW,1,1,PI / 6,2,1,0.3f,true };
enemyData[SHOOTME_ARMOR] = { "SHOOTME",enemy_ShootMe,YELLOW,6,1,PI / 6,2,1,0.3f,true,PowerupType::ARMOR,true };
enemyData[SHOOTME] = { "SHOOTME",enemy_ShootMe,YELLOW,1,1,0.5,2,1,0.2f,true };
enemyData[SHOOTME2] = { "SHOOTME2",enemy_ShootMe2,YELLOW,1,1,PI / 6,2,1,0.35f,true };
enemyData[ISHOOT] = { "ISHOOT",enemy_IShoot,YELLOW,1,1,0.5,2,3,0.4f,true };
enemyData[SHOOTME_ARMOR] = { "SHOOTME",enemy_ShootMe,YELLOW,6,1,0.5,2,1,0.3f,true,PowerupType::ARMOR,true };
enemyData[ISHOOT_MAP] = { "ISHOOT",enemy_IShoot,YELLOW,7,1,0.5,2,2,0.3f,true,PowerupType::STOP,true };
enemyData[SONAR] = { "Sonar",enemy_Sonar,RED,5,1,PI / 8,2,1 };
enemyData[COIN] = { "Coin",undefined,BLUE };
enemyData[POWERUP_ARMOR] = { "Armor",undefined,{96,0,96} };
@ -303,6 +310,8 @@ void FaceBall::ConvertBulletColor(Mesh& bullet, Pixel col) {
void FaceBall::LoadLevel(int level)
{
mode = GAMEMODE::GAME;
screenAlpha=screenAlpha2=0;
this->level = level;
restingTriangleYDepth = 0.f;
exitWallsCleared = false;
@ -316,6 +325,10 @@ void FaceBall::LoadLevel(int level)
bullets.clear();
enemies.clear();
powerups.clear();
wave2Enemies.clear();
wave3Enemies.clear();
knownGoodPositions.clear();
tagsRemaining=10;
exitCoords = { 0,0 };
for (int y = 0; y < MAP_SIZE.y; y++) {
std::vector<MapSquare>row;
@ -325,6 +338,7 @@ void FaceBall::LoadLevel(int level)
mapFloor.tris.push_back({ {{(float)x + 1,0,(float)y},{(float)x,0,(float)y + 1},{(float)x + 1,0,(float)y + 1}},{{1,0},{0,1},{1,1}},{WHITE,WHITE,WHITE}, floor_tex });
EnemyID id = mapData[y][x].enemyId;
if (id>=SHOOTME&& id < POWERUP_ARMOR) {
knownGoodPositions.push_back({x + 0.5f,y + 0.5f});
if (mapData[y][x].wave1) {
enemies.push_back({ id,vec3d{x + 0.5f,0,y + 0.5f},((int)mapData[y][x].facingDir - 1) * PI / 2,enemyData[id].radius });
} else
@ -1451,6 +1465,7 @@ void FaceBall::HandleKeys(float fElapsedTime) {
Enemy& e = enemies[enemyCollisionIndex];
e.Hurt(999);
e.setExploded(true);
wave2Enemies.push_back(e.freshCopy(true));
HurtPlayer(e.GetID(), 1, e.isBlinking());
hudShakeTime = shieldDuration >= 0?0.2f:0.6f;
}
@ -1464,6 +1479,7 @@ void FaceBall::HandleKeys(float fElapsedTime) {
Enemy& e = enemies[enemyCollisionIndex];
e.Hurt(999);
e.setExploded(true);
wave2Enemies.push_back(e.freshCopy(true));
HurtPlayer(e.GetID(), 1, e.isBlinking());
hudShakeTime = shieldDuration >= 0 ? 0.2f : 0.6f;
}
@ -1487,6 +1503,7 @@ void FaceBall::HandleKeys(float fElapsedTime) {
Enemy& e = enemies[enemyCollisionIndex];
e.Hurt(999);
e.setExploded(true);
wave2Enemies.push_back(e.freshCopy(true));
HurtPlayer(e.GetID(), 1, e.isBlinking());
hudShakeTime = shieldDuration >= 0 ? 0.2f : 0.6f;
}
@ -1500,6 +1517,7 @@ void FaceBall::HandleKeys(float fElapsedTime) {
Enemy& e = enemies[enemyCollisionIndex];
e.Hurt(999);
e.setExploded(true);
wave2Enemies.push_back(e.freshCopy(true));
HurtPlayer(e.GetID(), 1, e.isBlinking());
hudShakeTime = shieldDuration >= 0 ? 0.2f : 0.6f;
}
@ -1520,6 +1538,7 @@ void FaceBall::HandleKeys(float fElapsedTime) {
Enemy& e = enemies[enemyCollisionIndex];
e.Hurt(999);
e.setExploded(true);
wave2Enemies.push_back(e.freshCopy(true));
HurtPlayer(e.GetID(), 1, e.isBlinking());
hudShakeTime = shieldDuration >= 0 ? 0.2f : 0.6f;
}
@ -1533,6 +1552,7 @@ void FaceBall::HandleKeys(float fElapsedTime) {
Enemy& e = enemies[enemyCollisionIndex];
e.Hurt(999);
e.setExploded(true);
wave2Enemies.push_back(e.freshCopy(true));
HurtPlayer(e.GetID(), 1, e.isBlinking());
hudShakeTime = shieldDuration >= 0 ? 0.2f : 0.6f;
}
@ -1540,6 +1560,7 @@ void FaceBall::HandleKeys(float fElapsedTime) {
}
float distanceToExit = std::sqrtf(std::powf(player.GetPos().x - exit.pos.x, 2) + std::powf(player.GetPos().z - exit.pos.z, 2));
if (distanceToExit < player.GetRadius() + exit.radius) {
screenAlpha2=screenAlpha=0;
mode = LEVELCOMPLETE;
}
}
@ -1558,6 +1579,7 @@ void FaceBall::HandleKeys(float fElapsedTime) {
Enemy& e = enemies[enemyCollisionIndex];
e.Hurt(999);
e.setExploded(true);
wave2Enemies.push_back(e.freshCopy(true));
HurtPlayer(e.GetID(), 1, e.isBlinking());
hudShakeTime = shieldDuration >= 0 ? 0.2f : 0.6f;
}
@ -1571,6 +1593,7 @@ void FaceBall::HandleKeys(float fElapsedTime) {
Enemy& e = enemies[enemyCollisionIndex];
e.Hurt(999);
e.setExploded(true);
wave2Enemies.push_back(e.freshCopy(true));
HurtPlayer(e.GetID(), 1, e.isBlinking());
hudShakeTime = shieldDuration >= 0 ? 0.2f : 0.6f;
}
@ -1648,6 +1671,7 @@ bool FaceBall::OnUserCreate()
enemy_Sonar_tex = new Decal(new Sprite("assets/enemies/Sonar.png"));
hud = new Decal(new Sprite("assets/hud.png"));
exit_wall_tex = new Decal(new Sprite("assets/exitwall.png"));
enemy_ShootMe2_tex = new Decal(new Sprite("assets/enemies/ShootMe2.png"));
enemy_IShoot_tex = new Decal(new Sprite("assets/enemies/IShoot.png"));
life4 = new Decal(new Sprite("assets/life4.png"));
life3 = new Decal(new Sprite("assets/life3.png"));
@ -1660,8 +1684,9 @@ bool FaceBall::OnUserCreate()
powerups_tex = new Decal(new Sprite("assets/powerups.png"));
enemy_ShootMe = { "assets/enemies/ShootMe.obj", enemy_ShootMe_tex };
enemy_IShoot = { "assets/enemies/IShoot.obj", enemy_IShoot_tex };
enemy_ShootMe2 = { "assets/enemies/ShootMe2.obj", enemy_ShootMe2_tex };
enemy_Sonar = { "assets/enemies/Sonar.obj", enemy_Sonar_tex };
enemy_IShoot = { "assets/enemies/IShoot.obj", enemy_IShoot_tex};
bullet = { "assets/enemies/bullet.obj",bullet_tex };
powerup = { "assets/Powerup.obj",powerup_tex};
powerup2 = { "assets/Powerup2.obj",powerup2_tex };
@ -1945,6 +1970,7 @@ void FaceBall::RenderHud(float fElapsedTime) {
}
DrawStringPropDecal(vf2d{ hudOffset + (float)(ScreenWidth() / 2 - GetTextSizeProp(std::to_string(score)).x * 4 / 2) + 32,(float)(36 - GetTextSizeProp(std::to_string(score)).y * 4) + 18 } + hudAdjustment, std::to_string(score), { 192,96,96 }, { 4,4 });
DrawStringDecal(vf2d{ hudOffset + float(ScreenWidth() / 2 - GetTextSize(hudDisplayText).x / 2 * 4) + 32,float(ScreenHeight() - 128 - GetTextSize(hudDisplayText).y * 4) + 18 }, hudDisplayText, { 192,192,255 }, { 4,4 });
DrawStringDecal({float(ScreenWidth()-128),24},std::to_string(wave2Enemies.size()));
SetDecalMode(DecalMode::ADDITIVE);
DrawDecal({ float(ScreenWidth() / 2 - crosshair->sprite->width / 2),float(ScreenHeight() / 2 - crosshair->sprite->height / 2) }, crosshair, { 1,1 }, {255,255,255,128});
if (stopDuration > 0) {
@ -1963,6 +1989,10 @@ void FaceBall::RenderHud(float fElapsedTime) {
GradientFillRectDecal({ 0,float(ScreenHeight()/2)}, vf2d{(float)ScreenWidth() / 2,(float)ScreenHeight() / 2}, {(uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime>0.2f?120:hudShakeTime>0?64:0)}, {(uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime>0.2f?120:hudShakeTime>0?64:0)}, {(uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime>0.2f?120:hudShakeTime>0?64:0)}, { (uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime > 0.2f ? 64 : 0) });
GradientFillRectDecal({ float(ScreenWidth()/2),float(ScreenHeight() / 2)}, vf2d{(float)ScreenWidth() / 2,(float)ScreenHeight() / 2}, { (uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime > 0.2f ? 64 : 0) }, {(uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime>0.2f?120:hudShakeTime>0?64:0)}, {(uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime>0.2f?120:hudShakeTime>0?64:0)}, {(uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime>0.2f?120:hudShakeTime>0?64:0)});
FillRectDecal({ 0,0 }, vf2d{ (float)ScreenWidth(),(float)ScreenHeight() }, { (uint8_t)0,(uint8_t)0,(uint8_t)0,(uint8_t)screenAlpha });
if (screenAlpha>=254.f){
GradientFillRectDecal({0,0},{float(ScreenWidth()),float(ScreenHeight())},topCol,botCol,botCol,topCol);
FillRectDecal({ 0,0 }, vf2d{ (float)ScreenWidth(),(float)ScreenHeight() }, { (uint8_t)0,(uint8_t)0,(uint8_t)0,(uint8_t)screenAlpha2 });
}
}
void FaceBall::SubtractTag() {
@ -1981,13 +2011,13 @@ void FaceBall::SubtractTag() {
if (exitCoords.x != MAP_SIZE.x-1) {
map[exitCoords.y][exitCoords.x].wallE = NULL;
}
if (exitCoords.x-1 > 0) {
if (exitCoords.x > 0) {
map[exitCoords.y][exitCoords.x - 1].wallE = NULL;
}
if (exitCoords.x+1 < MAP_SIZE.x) {
map[exitCoords.y][exitCoords.x+1].wallW = NULL;
}
if (exitCoords.y-1 > 0) {
if (exitCoords.y > 0) {
map[exitCoords.y - 1][exitCoords.x].wallS = NULL;
}
if (exitCoords.y+1 < MAP_SIZE.y) {
@ -2041,7 +2071,7 @@ void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime,int myIndex) {
switch (e.GetID()) {
case SHOOTME:
case SHOOTME_ARMOR: {
e.rot += 0.5 * fElapsedTime;
e.rot += dat.rotSpd * fElapsedTime;
}break;
case SHOOTME2: {
switch (e.GetPhase()) {
@ -2052,8 +2082,9 @@ void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime,int myIndex) {
if (CheckPlayerCollision({ movementVec.x,0,movementVec.y }, { e.pos.x,e.pos.z }, e.radius)) {
e.Hurt(999);
e.setExploded(true);
wave2Enemies.push_back(e.freshCopy(true));
HurtPlayer(e.GetID(), 1, e.isBlinking());
hudShakeTime = 0.6f;
hudShakeTime = shieldDuration >= 0 ? 0.2f : 0.6f;
}
e.pos.x += movementVec.x;
e.pos.z += movementVec.y;
@ -2075,6 +2106,12 @@ void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime,int myIndex) {
}break;
}
}break;
case ISHOOT: {
e.rot += dat.rotSpd * fElapsedTime;
if (e.CanShoot()) {
e.ShootBullet(myIndex);
}
}break;
case ISHOOT2: {
switch (e.GetPhase()) {
case Phase::DEFAULT: {
@ -2084,8 +2121,9 @@ void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime,int myIndex) {
if (CheckPlayerCollision({ movementVec.x,0,movementVec.y }, { e.pos.x,e.pos.z }, e.radius)) {
e.Hurt(999);
e.setExploded(true);
wave2Enemies.push_back(e.freshCopy(true));
HurtPlayer(e.GetID(), 1, e.isBlinking());
hudShakeTime = 0.6f;
hudShakeTime = shieldDuration >= 0 ? 0.2f : 0.6f;
}
e.pos.x += movementVec.x;
e.pos.z += movementVec.y;
@ -2136,8 +2174,8 @@ bool FaceBall::OnUserUpdate(float fElapsedTime)
if (wave2Enemies.size()>0){
for (int i=0;i<wave2Enemies.size();i++){
Enemy&e=wave2Enemies[i];
if (CheckEnemyCollision({0,0,0},{e.pos.x,e.pos.z},e.radius)==-1&&
!CheckPlayerCollision({0,0,0},{e.pos.x,e.pos.z},e.radius)){
if (CheckEnemyCollision({0,0,0},{e.pos.x,e.pos.z},e.radius*3)==-1&&
!CheckPlayerCollision({0,0,0},{e.pos.x,e.pos.z},e.radius*6)){
enemies.push_back(e);
wave2Enemies.erase(wave2Enemies.begin()+i);
goto spawningDone;
@ -2147,8 +2185,8 @@ bool FaceBall::OnUserUpdate(float fElapsedTime)
if (wave3Enemies.size()>0){
for (int i=0;i<wave3Enemies.size();i++){
Enemy&e=wave3Enemies[i];
if (CheckEnemyCollision({0,0,0},{e.pos.x,e.pos.z},e.radius)==-1&&
!CheckPlayerCollision({0,0,0},{e.pos.x,e.pos.z},e.radius)){
if (CheckEnemyCollision({0,0,0},{e.pos.x,e.pos.z},e.radius*3)==-1&&
!CheckPlayerCollision({0,0,0},{e.pos.x,e.pos.z},e.radius*6)){
enemies.push_back(e);
wave3Enemies.erase(wave3Enemies.begin()+i);
goto spawningDone;
@ -2162,8 +2200,8 @@ bool FaceBall::OnUserUpdate(float fElapsedTime)
//Look at wave 2 enemies, and try to spawn one in.
for (int i=0;i<wave2Enemies.size();i++){
Enemy&e=wave2Enemies[i];
if (CheckEnemyCollision({0,0,0},{e.pos.x,e.pos.z},e.radius)==-1&&
!CheckPlayerCollision({0,0,0},{e.pos.x,e.pos.z},e.radius)){
if (CheckEnemyCollision({0,0,0},{e.pos.x,e.pos.z},e.radius*3)==-1&&
!CheckPlayerCollision({0,0,0},{e.pos.x,e.pos.z},e.radius*6)){
enemies.push_back(e);
wave2Enemies.erase(wave2Enemies.begin()+i);
break;
@ -2271,10 +2309,39 @@ bool FaceBall::OnUserUpdate(float fElapsedTime)
RenderHud(fElapsedTime);
if (screenAlpha < 255) {
screenAlpha = std::min(255.f,screenAlpha+200 * fElapsedTime);
if (screenAlpha>=254.f){
screenAlpha2 = 255.f;
int colInd=rand()%colorCycle.size();
topTargetColInd=(colInd+1)%colorCycle.size();
botTargetColInd=(topTargetColInd+1)%colorCycle.size();
topCol=topCurrentCol=colorCycle[colInd];
botCol=botCurrentCol=colorCycle[topTargetColInd];
topTargetCol=colorCycle[topTargetColInd];
botTargetCol=colorCycle[botTargetColInd];
}
}
else {
if (GetMouse(0).bPressed){
LoadLevel(++level);
}
if (screenAlpha2>0){
screenAlpha2 = std::max(0.f,screenAlpha2-200 * fElapsedTime);
}
DrawStringDecal({ 16,16 }, "Level " + std::to_string(level) + " complete!", WHITE, { 4,8 });
}
if (colTransferAmt<1){
colTransferAmt+=fElapsedTime*0.5;
topCol=PixelLerp(topCurrentCol,topTargetCol,colTransferAmt);
botCol=PixelLerp(botCurrentCol,botTargetCol,colTransferAmt);
} else {
topCol=topCurrentCol=colorCycle[topTargetColInd];
botCol=botCurrentCol=colorCycle[botTargetColInd];
topTargetColInd=(topTargetColInd+1)%colorCycle.size();
botTargetColInd=(topTargetColInd+1)%colorCycle.size();
topTargetCol=colorCycle[topTargetColInd];
botTargetCol=colorCycle[botTargetColInd];
colTransferAmt=0;
}
}break;
}
if (GetKey(olc::F5).bPressed) {
@ -2305,6 +2372,11 @@ void FaceBall::AddScore(int score) {
}
}
vf2d FaceBall::GetRandomizedSpawnPosition()
{
return knownGoodPositions[rand()%knownGoodPositions.size()];
}
void FaceBall::ResetScore() {
score = 0;
lastAwardedScore = 0;
@ -2323,7 +2395,7 @@ int FaceBall::EnemiesAlive(){
int main()
{
FaceBall demo;
if (demo.Construct(1280, 720, 1, 1))
if (demo.Construct(1280, 720, 2, 2))
demo.Start();
return 0;
}

@ -156,18 +156,6 @@ struct Bullet : Object{
bool Update(float fElapsedTime);
};
enum class PowerupType {
NONE,
ARMOR,
SPEED,
SHOTS,
STOP,
SHIELD,
CAMO,
MAP,
COIN
};
struct Powerup : Object {
PowerupType type;
Powerup(Mesh mesh, vec3d pos, float rot, PowerupType type);
@ -250,6 +238,7 @@ struct Enemy : public Object {
bool Update(float fElapsedTime);
void OnDeathEvent();
vf2d GetPlayerPosition();
Enemy freshCopy(bool randomizeLoc=false);
};
class FaceBall : public PixelGameEngine
@ -271,13 +260,15 @@ class FaceBall : public PixelGameEngine
std::vector<Powerup>powerups;
private:
Mesh mapWalls,mapFloor,enemy_ShootMe,undefined,
enemy_Sonar, mapExit,enemy_IShoot,powerup,powerup2;
enemy_Sonar, mapExit,enemy_ShootMe2,powerup,powerup2,
enemy_IShoot;
Decal* dot, * enemy_ShootMe_tex,*bullet_tex,*wall_tex,*floor_tex,
*enemy_Sonar_tex,*hud,*exit_wall_tex,*enemy_IShoot_tex,
*enemy_Sonar_tex,*hud,*exit_wall_tex,*enemy_ShootMe2_tex,*enemy_IShoot_tex,
*life4,*life3,*life2,*life1,*crosshair,*hudmeter,*powerup_tex,*powerup2_tex,
*powerups_tex;
vi2d exitCoords = { 0,0 };
std::vector<vf2d>knownGoodPositions;
std::vector<std::vector<MapSquare>>map;
std::vector<Object>objects;
GAMEMODE mode=GAMEMODE::GAME;
@ -292,6 +283,27 @@ class FaceBall : public PixelGameEngine
std::string hudDisplayText = "";
float stopDuration = 0,shieldDuration=0,camoDuration=0;
bool hasMapUpgrade = false;
std::array<Pixel,14>colorCycle={
RED,
BLACK,
YELLOW,
WHITE,
GREEN,
WHITE,
CYAN,
BLACK,
MAGENTA,
BLACK,
GREY,
WHITE,
BLUE,
BLACK
};
int topTargetColInd,botTargetColInd;
Pixel topTargetCol,botTargetCol;
Pixel topCurrentCol,botCurrentCol;
Pixel topCol,botCol;
float colTransferAmt=0;
mat4x4 matProj;
@ -351,6 +363,7 @@ class FaceBall : public PixelGameEngine
float hudShakeAmt = 0;
Pixel screenCol = WHITE;
float screenAlpha = 0;
float screenAlpha2 = 255.f;
float respawnTimer = 0;
vec3d spawnLoc = { 0,0.3,0 };
FacingDirection spawnFacingDir = FacingDirection::NORTH;
@ -417,4 +430,5 @@ class FaceBall : public PixelGameEngine
bool PlayerHasCamo();
vf2d GetPlayerPos();
void AddScore(int score);
vf2d GetRandomizedSpawnPosition();
};
Loading…
Cancel
Save