Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #331 from ModusCreateOrg/330
Browse files Browse the repository at this point in the history
330
  • Loading branch information
jaygarcia authored Dec 17, 2017
2 parents cb507f8 + 5a0c16b commit af81615
Show file tree
Hide file tree
Showing 12 changed files with 1,878 additions and 86 deletions.
14 changes: 7 additions & 7 deletions Evade2/Attract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ static const char scout_text[] PROGMEM = "SCOUT";
static const char bomber_text[] PROGMEM = "BOMBER";
static const char assault_text[] PROGMEM = "ASSAULT";

static const char credits1[] PROGMEM = "CRAFTED BY:\nMODUS CREATE\nDECEMBER 2017\n\n\nhttp://modus.co";
static const char credits2[] PROGMEM = "MUSIC and SFX:\nJAY GARCIA";
static const char credits3[] PROGMEM = "ART:\nMICHAEL TINTIUC\nJON VAN DALEN\nJD JONES\nJAY GARCIA";
static const char credits4[] PROGMEM = "PROGRAMMING:\nMIKE SCHWARTZ\nJAY GARCIA\nMICHAEL TINTIUC\n";
static const char credits5[] PROGMEM = "PROGRAMMING:\nDELIO BRIGNOLI\nSETH LEMMONS\nANDY DENNIS";
static const char credits6[] PROGMEM = "PROGRAMMING:\nVADIM POPA\nLUCAS STILL\nGRGUR GRISOGONO";
static const char credits1[] PROGMEM = "CRAFTED BY:\nMODUS CREATE\nDECEMBER 2017";
static const char credits2[] PROGMEM = "MUSIC and SFX:\nJ. GARCIA";
static const char credits3[] PROGMEM = "ART:\nM. TINTIUC\nJV DALEN\nJD JONES\nJ. GARCIA";
static const char credits4[] PROGMEM = "PROGRAMMING:\nM. SCHWARTZ\nJ. GARCIA\nM. TINTIUC\n";
static const char credits5[] PROGMEM = "PROGRAMMING:\nD. BRIGNOLI\nS. LEMMONS\nA. DENNIS";
static const char credits6[] PROGMEM = "PROGRAMMING:\nV. POPA\nL. STILL\nG. GRISOGONO";

const BYTE MAX_SCREEN = 2;
const BYTE MAX_CREDITS = 5;
Expand Down Expand Up @@ -138,7 +138,7 @@ void Attract::typewriter(Process *me, Object *o) {
Graphics::drawVectorGraphic(Enemy::enemy_graphic(ad->enemy), 64.0, 24.0, 0.0, 2.0);
}
if (game_mode == MODE_CREDITS) {
Font::scale = .85 * 256;
Font::scale = .9 * 256;
}
PGM_P p = ad->text;
BYTE x = ad->x, y = ad->y;
Expand Down
66 changes: 30 additions & 36 deletions Evade2/Boss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ static void engage_player_random_xy(Object *o) {
// Font::printf(5, 15, "%f", o->y - Camera::y);

if (o->state == 1) {
o->theta += 5 * Game::wave;
o->theta += 5 + Game::difficulty;
}
else {
o->theta -= 5 * Game::wave;
o->theta -= 5 + Game::difficulty;
}
// Debug
// o->x = Camera::x;
Expand All @@ -83,7 +83,7 @@ static void engage_player_random_xy(Object *o) {
return;
}
EBullet::fire(o, EBULLET_BOMB);
o->timer = Game::wave > 10 ? 0 : (20 - Game::difficulty);
o->timer = Game::wave > 20 ? 10 : (40 - Game::difficulty);
// Keep within bounds of the screen
if (o->x - Camera::x < -300) {
o->vx = random(3, 10 + Game::difficulty);
Expand Down Expand Up @@ -141,7 +141,7 @@ static void engage_player_flee(Object *o) {
}
EBullet::fire(o, EBULLET_BOMB);

o->timer = Game::wave > 10 ? 0 : (20 - Game::wave);
o->timer = Game::wave > 20 ? 20 : (50 - Game::difficulty);
// o->x = Camera::x;
// o->y = Camera::y;
o->vx += random(-7, 7);
Expand All @@ -155,7 +155,7 @@ static void init_orbit(Object *o, BOOL left) {
o->x = cos(angle) * 256;
o->z = Camera::z + sin(angle) * 256;
o->y = Camera::y + random(30, 90);
o->vy = random(-5, 5) + (Game::difficulty * 2);
o->vy = random(-6 + (Game::difficulty * -1), 6 + (Game::difficulty));
o->vx = 0;
o->vz = -50 - (Game::difficulty * 2);
o->state = left ? 0 : 180;
Expand Down Expand Up @@ -193,9 +193,10 @@ static void engage_player_orbit(Object *o) {
o->z = Camera::z + sin(rad) * 512;

if (--o->timer <= 0) {
o->timer = Game::wave > 10 ? 0 : (20 - Game::wave);
o->timer = Game::wave > 20 ? 20 : (50 - Game::difficulty);
EBullet::fire(o, EBULLET_BOMB);
}

}

/**
Expand Down Expand Up @@ -236,12 +237,12 @@ void Boss::action(Process *me, Object *o) {
o->lines = NULL;

if (Boss::boss_type == 1) {
o->y = random(-5, 5);
// o->y = random(-5, 5);
o->state = (o->state == 1) ? 0 : 1;
}
else if (Boss::boss_type == 2) {
init_orbit(o, random() & 1);
}
// else if (Boss::boss_type == 2) {
// init_orbit(o, random() & 1);
// }
// else {
// randomize_flee(o);
// }
Expand Down Expand Up @@ -304,48 +305,41 @@ void Boss::start_action(Process *me, Object *o) {

void Boss::entry(Process *me, Object *o) {
// production
Boss::boss_type = random(1, 3);

// Debugging
// Boss::boss_type = 1;

game_mode = MODE_NEXT_WAVE;
Game::kills = 0;
Camera::vz = -20;

o->set_type(OTYPE_ENEMY);
o->lines = getBossLines();
o->z = Camera::z + z_dist;

o->state = 0;
o->vz = Camera::vz;



// PRODUCTION
Boss::hit_points = 10 + (Game::difficulty * Boss::boss_type);

//DEBUG
// Boss::hit_points = 1;



if (Boss::boss_type == 1) {
o->x = Camera::x + 512;
o->vx = -10;
o->y = Camera::y;
Sound::play_score(STAGE_1_BOSS_SONG);
if (Game::wave % 3 == 0) {
Boss::boss_type = 3;
o->x = Camera::x - 512;
o->vx = +10;
o->vy = random(-3, 3);
Sound::play_score(STAGE_3_BOSS_SONG);
}
else if (Boss::boss_type == 2) {
else if (Game::wave % 2 == 0) {
Boss::boss_type = 2;
init_orbit(o, random() & 1);
Sound::play_score(STAGE_2_BOSS_SONG);
}
else {
o->x = Camera::x - 512;
o->vx = +10;
o->vy = random(-3, 3);
Sound::play_score(STAGE_3_BOSS_SONG);
else {
Boss::boss_type = 1;
o->x = Camera::x + 512;
o->vx = -10;
o->y = Camera::y;
Sound::play_score(STAGE_1_BOSS_SONG);
}

o->lines = getBossLines();

// PRODUCTION
Boss::hit_points = 20 + (Game::difficulty * Boss::boss_type);
// Boss::hit_points = 1;
me->sleep(1, Boss::start_action);
}
2 changes: 1 addition & 1 deletion Evade2/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void Camera::move() {
// return TRUE if o collides with player
BOOL Camera::collides_with(Object *o) {
// If enemy bullet collides with player
if (abs(o->z - Camera::z) < abs(o->vz) && abs(o->x - Camera::x) < 128 && abs(o->y - Camera::y) < 64) {
if (abs(o->z - Camera::z) < abs(o->vz) && abs(o->x - Camera::x) < 64 && abs(o->y - Camera::y) < 64) {
return TRUE;
}
return FALSE;
Expand Down
2 changes: 1 addition & 1 deletion Evade2/EBullet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void EBullet::run() {
}

BOOL EBullet::fire(Object *oo, BYTE type) {
const FLOAT frames = 64 / Game::difficulty; // time to hit player (how many ticks)
const FLOAT frames = 90 / Game::difficulty; // time to hit player (how many ticks)

if (game_mode != MODE_GAME) {
return FALSE;
Expand Down
24 changes: 14 additions & 10 deletions Evade2/Enemy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ static void init_scout(Object *o) {
static void init_bomber(Object *o) {
o->x = Camera::x + 128 - random(0, 127);
o->y = Camera::y + 128 - random(0, 127);
o->z = Camera::z - 10;
o->vz = CAMERA_VZ + 2;
o->z = Camera::z - 30;
o->vz = CAMERA_VZ + 1 + Game::wave;
o->vx = o->vy = 0;
}

Expand All @@ -132,21 +132,23 @@ void Enemy::init(Process *me, Object *o) {
o->timer = FIRE_TIME;
o->theta = 0;

switch (random(0, 3)) {

// One enemy type enters per wave
switch (random(0, (Game::wave > 3) ? 3 : Game::wave)) {
case 0:
o->lines = (const BYTE *)&enemy_assault_1_img;
init_assault(o, random() & 1);
me->sleep(1, orbit);
o->lines = (const BYTE *)&enemy_scout_1_img;
init_scout(o);
me->sleep(1, seek);
break;
case 1:
o->lines = (const BYTE *)&enemy_heavy_bomber_1_img;
init_bomber(o);
me->sleep(1, evade);
break;
case 2:
o->lines = (const BYTE *)&enemy_scout_1_img;
init_scout(o);
me->sleep(1, seek);
o->lines = (const BYTE *)&enemy_assault_1_img;
init_assault(o, random() & 1);
me->sleep(1, orbit);
break;
}
}
Expand All @@ -172,7 +174,9 @@ void Enemy::wait_init(Process *me, Object *o) {
* number and then puts the Process into wait_init state.
*/
void Enemy::respawn(Process *me, Object *o) {
o->timer = random(0, 40) + 20;
// o->timer = random(30, 40) + 20;
o->timer = random(Game::wave > 6 ? 30 : 30, 60) + 30;

me->sleep(1, Enemy::wait_init);
}

Expand Down
31 changes: 21 additions & 10 deletions Evade2/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ UBYTE Game::kills;
const BYTE alert_top = 5;

const BYTE getStageSong() {
if (Game::wave % 3 == 0) {
if (Game::wave % 4 == 0) {
return INTRO_SONG;
}
else if (Game::wave % 3 == 0) {
return STAGE_3_SONG;
}
if (Game::wave % 2 == 0) {
else if (Game::wave % 2 == 0) {
return STAGE_2_SONG;
}
return STAGE_1_SONG;
Expand All @@ -24,20 +27,25 @@ void Game::birth() {
ProcessManager::birth(Enemy::entry);
ProcessManager::birth(Enemy::entry);
ProcessManager::birth(Enemy::entry);
const BYTE num_asteroids = min(max(Game::wave, 3), 1) + 1;
for (BYTE i = 0; i < num_asteroids; i++) {
ProcessManager::birth(Asteroid::entry);
}

if (Game::wave > 3) {
const BYTE num_asteroids = min(max(Game::wave, 3), 1) + 1;
for (BYTE i = 0; i < num_asteroids; i++) {
ProcessManager::birth(Asteroid::entry);
}
}
}

//TODO: Increase difficulty every 4 waves
void Game::next_wave(Process *me, Object *o) {
if (--Game::kills <= 0) {
game_mode = MODE_GAME;
Game::difficulty++;
Game::kills = 0;
Camera::vz = CAMERA_VZ;
Game::wave++; // <-- Use this with Kills

if (Game::wave % 4 == 0) {
Game::difficulty++;
}
Sound::play_score(getStageSong());

EBullet::genocide();
Expand All @@ -53,6 +61,7 @@ void Game::next_wave(Process *me, Object *o) {
Font::printf(26, alert_top, "START WAVE %d", Game::wave + 1);
Font::scale = 256;
Player::recharge_shield();
Player::recharge_power();
me->sleep(1);
}
}
Expand All @@ -68,7 +77,9 @@ void Game::spawn_boss(Process *me, Object *o) {
}
else {
Font::scale = 190;
Font::printf(23, alert_top, "ACE APPROACHING!");
Font::printf(35, alert_top, "WARP TO ACE!");
Player::recharge_shield();
Player::recharge_power();
Font::scale = 256;
me->sleep(1);
}
Expand All @@ -82,7 +93,7 @@ void Game::run() {
// if (Game::kills > (4 * Game::wave) * Game::difficulty) {

// Slower increase
if (Game::kills > (5 * Game::difficulty) + Game::wave) {
if (Game::kills > ((10 + Game::wave) * Game::difficulty)) {

game_mode = MODE_NEXT_WAVE;
// next wave
Expand Down
51 changes: 32 additions & 19 deletions Evade2/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ void Player::recharge_shield() {
}
}

void Player::recharge_power() {
if (power < MAX_POWER) {
power++;
}
}

void Player::before_render() {
if (game_mode != MODE_GAME) {
Camera::vx = Camera::vy = 0;
Expand Down Expand Up @@ -214,26 +220,33 @@ void Player::after_render() {
deltaXCrossHairs = 0,
deltaYCrossHairs = 0;

if (Controls::pressed(JOYSTICK_RIGHT)) {
consoleX = 38;
deltaXMeter = -1;
deltaXCrossHairs = 4;
}
else if (Controls::pressed(JOYSTICK_LEFT)) {
consoleX = 42;
deltaXMeter = 1;
deltaXCrossHairs = -4;
}
// Font::scale = .6 * 256;
// Font::printf(5,5,"D %d", Game::difficulty);
// Font::printf(5,12,"W %d", Game::wave);
// Font::scale = 256;
if (game_mode != MODE_GAME) {

if (Controls::pressed(JOYSTICK_UP)) {
consoleY = 56;
deltaYMeter = -1;
deltaYCrossHairs = 4;
}
else if (Controls::pressed(JOYSTICK_DOWN)) {
consoleY = 60;
deltaYMeter = 1;
deltaYCrossHairs = -4;
if (Controls::pressed(JOYSTICK_RIGHT)) {
consoleX = 38;
deltaXMeter = -1;
deltaXCrossHairs = 4;
}
else if (Controls::pressed(JOYSTICK_LEFT)) {
consoleX = 42;
deltaXMeter = 1;
deltaXCrossHairs = -4;
}

if (Controls::pressed(JOYSTICK_UP)) {
consoleY = 56;
deltaYMeter = -1;
deltaYCrossHairs = 4;
}
else if (Controls::pressed(JOYSTICK_DOWN)) {
consoleY = 60;
deltaYMeter = 1;
deltaYCrossHairs = -4;
}
}

Graphics::drawBitmap(consoleX, consoleY, hud_console_img, 0x30, 0x08);
Expand Down
1 change: 1 addition & 0 deletions Evade2/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Player {
public:
static void init();
static void recharge_shield();
static void recharge_power();

static void hit(BYTE amount);
// this is called before rendering everything
Expand Down
2 changes: 1 addition & 1 deletion Evade2/sound/SFX.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const PROGMEM struct SFX_next_attract_char_data {
.fmt = ATM_SCORE_FMT_MINIMAL_MONO,
.pattern0 = {
ATM_CMD_M_SET_TEMPO(1),
ATM_CMD_M_SET_VOLUME(60),
ATM_CMD_M_SET_VOLUME(80),
ATM_CMD_I_NOTE_D5,
ATM_CMD_M_DELAY_TICKS(1),
ATM_CMD_I_STOP,
Expand Down
Loading

0 comments on commit af81615

Please sign in to comment.