Compare commits

...

2 Commits

  1. 11
      Faceball2030/assets/enemies/ShootMe2.mtl
  2. 1605
      Faceball2030/assets/enemies/ShootMe2.obj
  3. BIN
      Faceball2030/assets/enemies/ShootMe2.png
  4. BIN
      Faceball2030/assets/enemies/ShootMe2.wings
  5. BIN
      Faceball2030/assets/enemies/ShootMe2.xcf
  6. BIN
      Faceball2030/assets/enemies/sphere1_auv.png
  7. 53
      Faceball2030/main.cpp
  8. 1
      Faceball2030/main.h

@ -0,0 +1,11 @@
# Exported from Wings 3D 2.2.9
newmtl sphere1_auv
Ns 19.999999999999996
d 1.0
illum 2
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 sphere1_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: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@ -218,6 +218,11 @@ bool Enemy::Update(float fElapsedTime) {
}
}
}
else
if (fElapsedTime > 3/120.f) {
mesh.tris.clear();
return false;
}
}
return true;
}
@ -260,7 +265,7 @@ void FaceBall::InitializeEnemyData() {
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[ISHOOT_MAP] = { "ISHOOT",enemy_IShoot,YELLOW,7,1,0.5,2,2,0.3f,true,PowerupType::MAP,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} };
@ -2017,10 +2022,15 @@ void FaceBall::RenderHud(float fElapsedTime) {
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
if (x != 0 && y != 0) {
if (lookingAtText != "") {
DrawStringDecal(vf2d{ hudOffset + float(ScreenWidth() / 2 - GetTextSize(lookingAtText).x / 2 * 4) + 32,float(ScreenHeight() - 128 - GetTextSize(lookingAtText).y * 4) + 18 } + vf2d{ float(x),float(y) }, lookingAtText, DARK_BLUE, { 4,4 });
}
else {
DrawStringDecal(vf2d{ hudOffset + float(ScreenWidth() / 2 - GetTextSize(hudDisplayText).x / 2 * 4) + 32,float(ScreenHeight() - 128 - GetTextSize(hudDisplayText).y * 4) + 18 } + vf2d{ float(x),float(y) }, hudDisplayText, DARK_BLUE, { 4,4 });
}
}
}
}
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
if (x != 0 && y != 0) {
@ -2029,7 +2039,12 @@ 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 });
if (lookingAtText != "") {
DrawStringDecal(vf2d{ hudOffset + float(ScreenWidth() / 2 - GetTextSize(lookingAtText).x / 2 * 4) + 32,float(ScreenHeight() - 128 - GetTextSize(lookingAtText).y * 4) + 18 }, lookingAtText, { 192,192,255 }, { 4,4 });
}
else {
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});
@ -2229,7 +2244,7 @@ bool FaceBall::PlayerHasMapUpgrade(){
bool FaceBall::OnUserUpdate(float fElapsedTime)
{
fElapsedTime = std::min(0.01667f, fElapsedTime);
fElapsedTime = std::min(2/60.f, fElapsedTime);
gameTimer += fElapsedTime;
switch (mode) {
case GAME: {
@ -2296,14 +2311,21 @@ bool FaceBall::OnUserUpdate(float fElapsedTime)
it++;
}
}
for (int i = 0; i < enemies.size(); i++) {
Enemy& e = enemies[i];
e.Update(fElapsedTime);
int counter = 0;
for (std::vector<Enemy>::iterator it = enemies.begin(); it != enemies.end();) {
Enemy& e = *it;
if (!e.Update(fElapsedTime)) {
it = enemies.erase(it);
}
else {
if (e.isLastHitTimerActive()) {
e.reduceLastHitTimer(fElapsedTime);
}
if (stopDuration < 0) {
RunEnemyAI(e, fElapsedTime, i);
RunEnemyAI(e, fElapsedTime, counter);
}
it++;
counter++;
}
}
for (std::vector<Powerup>::iterator it = powerups.begin(); it != powerups.end();) {
@ -2360,6 +2382,25 @@ bool FaceBall::OnUserUpdate(float fElapsedTime)
}
}
if (hp > 0) {
vf2d checkPos = {player.GetPos().x, player.GetPos().z};
lookingAtText = "";
while (true) {
if (checkPos.x<0 || checkPos.y<0 || checkPos.x>MAP_SIZE.x || checkPos.y>MAP_SIZE.y) break;
vf2d checkVec = { std::cosf(fYaw) * 0.1f,std::sinf(fYaw) * 0.1f };
if (CheckCollision({ checkVec.x,0,checkVec.y }, checkPos, 0.1f)) break;
checkPos.x += checkVec.x;
checkPos.y += checkVec.y;
for (Enemy&e : enemies) {
if (!e.isDead()) {
float dist = std::sqrtf(std::powf(checkPos.x - e.pos.x, 2) + std::powf(checkPos.y - e.pos.z, 2));
if (dist <= e.radius) {
lookingAtText = enemyData[e.GetID()].name;
goto afterPositionCheck;
}
}
}
}
afterPositionCheck:
HandleKeys(fElapsedTime);
RenderWorld();
}

@ -287,6 +287,7 @@ class FaceBall : public PixelGameEngine
double gameTimer = 0;
int lastPowerupCollidedWith = -1;
std::string hudDisplayText = "";
std::string lookingAtText = "";
float stopDuration = 0,shieldDuration=0,camoDuration=0;
bool hasMapUpgrade = false;
std::array<Pixel,14>colorCycle={

Loading…
Cancel
Save