Im making a vertical shooter. I can get the enemies to move around and come and ram their ship at me, but I wrote some code for them to shoot bullets at me but nothing happens here is my code, I will highlight the bullet code in bold
header file
#pragma once
#include <allegro.h>
#include "mappyal.h"
#include <iostream>
using namespace std;
//Must run at 640 x 480
#define WIDTH 640
#define HEIGHT 480
//Color macros
#define WHITE makecol(255, 255, 255)
#define GRAY makecol(60, 60, 60)
#define RED makecol(200, 0, 0)
#define BLACK makecol(0, 0, 0)
#define BLUE makecol(0, 0, 255)
//Game macros
#define MAX_ENEMIES 20
#define MAX_BULLETS 20
#define MAX_EXPLOSIONS 10
#define BOTTOM 48000 - HEIGHT
#define MAX_ENEMY_BULLETS 20
//Sprite class
class SPRITE
{
public:
int dir, alive;
int x, y;
int width, height;
int xspeed, yspeed;
int xdelay, ydelay;
int xcount, ycount;
int curframe, maxframe, animdir;
int framecount, framedelay;
};
//y offset in pixel
extern int yoffset;
//Player variables
extern int firecount;
extern int firedelay;
extern int health;
extern int score;
//Sound effects
extern SAMPLE *sounds[10];
extern int volume;
extern int pitch;
extern int pan;
//Bitmaps and sprites
extern BITMAP *buffer;
extern BITMAP *temp;
extern BITMAP *explosion_images[6];
extern SPRITE *explosions[MAX_EXPLOSIONS];
extern BITMAP *bigexp_images[7];
extern SPRITE *bigexp;
extern BITMAP *player_images[3];
extern SPRITE *player;
extern BITMAP *bullet_images[2];
extern SPRITE *bullets[MAX_BULLETS];
extern BITMAP *enemy_plane_images[3];
extern SPRITE *enemy_planes[MAX_ENEMIES];
extern BITMAP *progress, *bar;
extern BITMAP *bonus_shot_image;
extern SPRITE *bonus_shot;
extern int gameover;
extern BITMAP *gameend;
extern BITMAP *enemy_bullet_image;
extern SPRITE *enemy_bullets[MAX_ENEMY_BULLETS];
//Function prototypes
BITMAP *grabframe(BITMAP *source, int width, int height,
int startx, int starty, int columns, int frame);
void loadsprite();
int inside(int x, int y, int left, int top, int right, int bottom);
void updatesprite(SPRITE *spr);
void startexplosion(int x, int y);
void updateexplosions();
void updatebonuses();
void updatebullet(SPRITE *spr);
void updatebullets();
void fireatenemy();
void bouncex_warpy(SPRITE *spr);
void displayprogress(int life);
void updateenemyplanes();
void updatescroller();
void updateplayer();
void checkinput();
void initialize();
void endgame(int &health, int &score);
void loadsounds();
void updateenemybullet(SPRITE *spr);
void updateenemybullets();
void fireatplayer();
My bullet code is located in the implementation file. the functions are called updateenemybulle, updatenememybullets, and fireatplayer(I call this in updateenemyplanes()). Skip the loadsprites code. Im just loading them in
heres the implementation file
//global variables BITMAP *buffer; BITMAP *temp; BITMAP *explosion_images[6]; SPRITE *explosions[MAX_EXPLOSIONS]; BITMAP *bigexp_images[7]; SPRITE *bigexp; BITMAP *player_images[3]; SPRITE *player; BITMAP *bullet_images[2]; SPRITE *bullets[MAX_BULLETS]; BITMAP *enemy_plane_images[3]; SPRITE *enemy_planes[MAX_ENEMIES]; BITMAP *progress, *bar; BITMAP *bonus_shot_image; SPRITE *bonus_shot; BITMAP *gameend; BITMAP *enemy_bullet_image; SPRITE *enemy_bullets[MAX_ENEMY_BULLETS]; //The sounds SAMPLE *sounds[10]; //sound variables int volume = 400; int pitch = 1000; int pan = 1000; //y offset in pixel int yoffset = BOTTOM; //Player variables int firecount = 0; int firedelay = 60; int health = 25; int score = 0; int gameover = 0; //Grabs the frame of a sprite sheet BITMAP *grabframe(BITMAP *source, int width, int height, int startx, int starty, int columns, int frame) { BITMAP *temp = create_bitmap(width, height); int x = startx + (frame % columns) * width; int y = starty + (frame / columns) * height; blit(source, temp, x, y, 0, 0, width, height); return temp; } //Load all the sprites into the game void loadsprite() { //counter variable int n; //load the progress bar temp = load_bitmap("progress.bmp", NULL); progress = grabframe(temp, 130, 14, 0, 0, 1, 0); bar = grabframe(temp, 6, 10, 130, 2, 1, 0); destroy_bitmap(temp); //load the bonus shot bonus_shot_image = load_bitmap("bonusshot.bmp", NULL); bonus_shot = new SPRITE; bonus_shot->alive = 0; bonus_shot->x = 0; bonus_shot->y = 0; bonus_shot->width = bonus_shot_image->w; bonus_shot->height = bonus_shot_image->h; bonus_shot->xdelay = 0; bonus_shot->ydelay = 2; bonus_shot->xcount = 0; bonus_shot->ycount = 0; bonus_shot->xspeed = 0; bonus_shot->yspeed = 1; //moving down the screen bonus_shot->curframe = 0; bonus_shot->maxframe = 0; bonus_shot->framecount = 0; bonus_shot->framedelay = 0; //Load the player temp = load_bitmap("p38.bmp", NULL); for(n = 0; n < 3; n++) { player_images[n] = grabframe(temp, 64, 64, 0, 0, 3, n); } destroy_bitmap(temp); player = new SPRITE; player->x = 320 - 32; //middle of screen player->y = 400; //nearly bottom of screen player->width = player_images[0]->w; player->height = player_images[0]->h; player->xdelay = 1; player->ydelay = 0; player->xcount = 0; player->ycount = 0; player->xspeed = 0; player->yspeed = 0; player->curframe = 0; player->maxframe = 2; player->framecount = 0; player->framedelay = 10; player->animdir = 1; //Load the bullets bullet_images[0] = load_bitmap("bullets.bmp", NULL); for(n = 0; n < MAX_BULLETS; n++) { bullets[n] = new SPRITE; bullets[n]->alive = 0; bullets[n]->x = 0; bullets[n]->y = 0; bullets[n]->width = bullet_images[0]->w; bullets[n]->height = bullet_images[0]->h; bullets[n]->xdelay = 0; bullets[n]->ydelay = 0; bullets[n]->xcount = 0; bullets[n]->ycount = 0; bullets[n]->xspeed = 0; bullets[n]->yspeed = -2; //moving up the screen bullets[n]->curframe = 0; bullets[n]->maxframe = 0; bullets[n]->framecount = 0; bullets[n]->framedelay = 0; bullets[n]->animdir = 0; } //Load the enemy bullets enemy_bullet_image = load_bitmap("enemy_bullet.bmp", NULL); for(n = 0; n < MAX_ENEMY_BULLETS; n++) { enemy_bullets[n] = new SPRITE; enemy_bullets[n]->alive = 0; enemy_bullets[n]->x = 0; enemy_bullets[n]->y = 0; enemy_bullets[n]->width = enemy_bullet_image->w; enemy_bullets[n]->height = enemy_bullet_image->h; enemy_bullets[n]->xcount = 0; enemy_bullets[n]->ycount = 0; enemy_bullets[n]->xdelay = 0; enemy_bullets[n]->ydelay = 0; enemy_bullets[n]->xspeed = 0; enemy_bullets[n]->yspeed = 2; enemy_bullets[n]->curframe = 0; enemy_bullets[n]->maxframe = 0; enemy_bullets[n]->framecount = 0; enemy_bullets[n]->framedelay = 0; enemy_bullets[n]->animdir = 0; } //load the enemy planes temp = load_bitmap("enemyplane1.bmp", NULL); for(n = 0; n < 3; n++) { enemy_plane_images[n] = grabframe(temp, 32, 32, 0, 0, 3, n); } destroy_bitmap(temp); for(n = 0; n < MAX_ENEMIES; n++) { enemy_planes[n] = new SPRITE; enemy_planes[n]->alive = 0; enemy_planes[n]->x = rand() % 100 + 50; enemy_planes[n]->y = 0; enemy_planes[n]->width = enemy_plane_images[0]->w; enemy_planes[n]->height = enemy_plane_images[0]->h; enemy_planes[n]->xdelay = 4; enemy_planes[n]->ydelay = 4; enemy_planes[n]->xcount = 0; enemy_planes[n]->ycount = 0; enemy_planes[n]->xspeed = (rand() % 2 - 3); enemy_planes[n]->yspeed = 1; //moving down the screen enemy_planes[n]->curframe = 0; enemy_planes[n]->maxframe = 2; enemy_planes[n]->framecount = 0; enemy_planes[n]->framedelay = 10; enemy_planes[n]->animdir = 1; } //Load the explosions temp = load_bitmap("explosion.bmp", NULL); for(n = 0; n < 6; n++) { explosion_images[n] = grabframe(temp, 32, 32, 0, 0, 6, n); } destroy_bitmap(temp); for(n = 0; n < MAX_EXPLOSIONS; n++) { explosions[n] = new SPRITE; explosions[n]->alive = 0; explosions[n]->x = 0; explosions[n]->y = 0; explosions[n]->width = explosion_images[0]->w; explosions[n]->height = explosion_images[0]->h; explosions[n]->xdelay = 0; explosions[n]->ydelay = 8; explosions[n]->xcount = 0; explosions[n]->ycount = 0; explosions[n]->yspeed = -1; //moving up the screen explosions[n]->xspeed = 0; explosions[n]->curframe = 0; explosions[n]->maxframe = 5; explosions[n]->framecount = 0; explosions[n]->framedelay = 15; explosions[n]->animdir = 1; } //load the big explosions temp = load_bitmap("bigexplosion.bmp", NULL); for(n = 0; n < 7; n++) { bigexp_images[n] = grabframe(temp, 64, 64, 0, 0, 7, n); } destroy_bitmap(temp); bigexp = new SPRITE; bigexp->alive = 0; bigexp->x = 0; bigexp->y = 0; bigexp->width = bigexp_images[0]->w; bigexp->height = bigexp_images[0]->h; bigexp->xdelay = 0; bigexp->ydelay = 8; bigexp->xcount = 0; bigexp->ycount = 0; bigexp->xspeed = 0; bigexp->yspeed = -1; //moves up the screen bigexp->curframe = 0; bigexp->maxframe = 6; bigexp->framecount = 0; bigexp->framedelay = 10; bigexp->animdir = 1; } //detects if a sprite is inside another one (collision detection) int inside(int x, int y, int left, int top, int right, int bottom) { if(x > left && x < right && y > top && y < bottom) return 1; else return 0; } //animates and moves the sprites void updatesprite(SPRITE *spr) { //update the x position if(++spr->xcount > spr->xdelay) { spr->xcount = 0; spr->x += spr->xspeed; } //update the y position if(++spr->ycount > spr->ydelay) { spr->ycount = 0; spr->y += spr->yspeed; } //update the frame based on animdir if(++spr->framecount > spr->framedelay) { spr->framecount = 0; if(spr->animdir == -1) { if(--spr->curframe < 0) spr->curframe = spr->maxframe; } if(spr->animdir == 1) { if(++spr->curframe > spr->maxframe) spr->curframe = 0; } } } void startexplosion(int x, int y) { int n; for(n = 0; n < MAX_EXPLOSIONS; n++) { //check to see if the explosions are inactive if(!explosions[n]->alive) { //make the explosions active explosions[n]->alive++; explosions[n]->x = x; explosions[n]->y = y; break; } } //launch bonus shot if ready if(!bonus_shot->alive) { bonus_shot->alive++; bonus_shot->x = x; bonus_shot->y = y; } } //responsible for drawing and moving the explosions void updateexplosions() { int n, c = 0; for(n = 0; n < MAX_EXPLOSIONS; n++) { if(explosions[n]->alive) { c++; updatesprite(explosions[n]); draw_sprite(buffer, explosion_images[explosions[n]->curframe], explosions[n]->x, explosions[n]->y); //once the explosion is complete, kill it if(explosions[n]->curframe >= explosions[n]->maxframe) { explosions[n]->curframe = 0; explosions[n]->alive = 0; } } } //textprintf_ex(buffer, font, 0, 430, WHITE, -1, "explosions %d", c); //update the big "player" explosion if needed if(bigexp->alive) { updatesprite(bigexp); draw_sprite(buffer, bigexp_images[bigexp->curframe], bigexp->x, bigexp->y); if(bigexp->curframe >= bigexp->maxframe) { bigexp->curframe = 0; bigexp->alive = 0; } } } //responsible for drawing and moving the bonuses void updatebonuses() { int x, y, x1, y1, x2, y2; //add more bonuses(yes , YOU!) //update bonus shot if alive if(bonus_shot->alive) { updatesprite(bonus_shot); draw_sprite(buffer, bonus_shot_image, bonus_shot->x, bonus_shot->y); if(bonus_shot->y > HEIGHT) bonus_shot->alive = 0; //see if player got bonus shot x = bonus_shot->x + bonus_shot->width/2; y = bonus_shot->y + bonus_shot->height/2; x1 = player->x; y1 = player->y; x2 = player->x + player->width; y2 = player->y + player->height; if(inside(x, y, x1, y1, x2, y2)) { //increase firing rate if(firedelay > 20) firedelay -= 2; bonus_shot->alive = 0; } } } void updatebullet(SPRITE *spr) { int n, x, y; int x1, y1, x2, y2; //move the bullets updatesprite(spr); //check bounds if(spr->y < 0) { spr->alive = 0; return; } for(n = 0; n < MAX_ENEMIES; n++) { if(enemy_planes[n]->alive) { //find the center of the bullets x = spr->x + spr->width/2; y = spr->y + spr->height/2; //get enemy bounding rectangle x1 = enemy_planes[n]->x; y1 = enemy_planes[n]->y - yoffset; x2 = x1 + enemy_planes[n]->width; y2 = y1 + enemy_planes[n]->height; //check for collisions if(inside(x, y, x1, y1, x2, y2)) { enemy_planes[n]->alive = 0; play_sample(sounds[1], volume, pan, pitch, FALSE); spr->alive = 0; startexplosion(spr->x+16, spr->y); score += 2; break; } } } } void updatebullets() { int n; //update/drawbullets for(n = 0; n < MAX_BULLETS; n++) { if(bullets[n]->alive) { updatebullet(bullets[n]); draw_sprite(buffer, bullet_images[0], bullets[n]->x, bullets[n]->y); } } } void updateenemybullet(SPRITE *spr) { int n, x, y; int x1, y1, x2, y2; //update the bullets updatesprite(spr); //check bounds if(spr->y > SCREEN_H) { spr->alive = 0; return; } //if the player is alive if(player->alive) { //find the center of the bullets x = spr->x + spr->width/2; y = spr->y + spr->height/2; //get the player bounding rectangle x1 = player->x; y1 = player->y + yoffset; x2 = x1 + player->width; y2 = y1 + player->height; //check for collisions if(inside(x, y, x1, y1, x2, y2)) { spr->alive = 0; play_sample(sounds[2], volume, pan, pitch, FALSE); if(health > 0) { health--; } bigexp->alive++; bigexp->x = player->x; bigexp->y = player->y; score--; } } } void updateenemybullets() { int n; //update draw bullets for(n = 0; n < MAX_ENEMY_BULLETS; n++) { if(enemy_bullets[n]->alive) { updateenemybullet(enemy_bullets[n]); draw_sprite(buffer, enemy_bullet_image, enemy_bullets[n]->x, enemy_bullets[n]->y); } } } //shoots bullets from the players plane void fireatenemy() { int n; for(n = 0; n < MAX_BULLETS; n++) { if(!bullets[n]->alive) { bullets[n]->alive++; bullets[n]->x = player->x; bullets[n]->y = player->y; return; } } } //make the enemies shoot at the player randomly void fireatplayer(SPRITE *enemy) { int n; for(n = 0; n < MAX_ENEMY_BULLETS; n++) { if(!enemy_bullets[n]->alive) { enemy_bullets[n]->alive++; enemy_bullets[n]->x = enemy->x; enemy_bullets[n]->y = enemy->y; return; } } } void bouncex_warpy(SPRITE *spr) { //if x position of sprite goes beyond left side of screen //bounce it back if(spr->x < 0 - spr->width) { spr->x = 0 - spr->width+1; //make sprite go in opposite direction spr->xspeed *= -1; } //if it goes beyond right side of screen else if(spr->x > SCREEN_W) { spr->x = SCREEN_W - spr->xspeed; //go the opposite direction spr->xspeed *= -1; } //warp y if plane has passed player if(spr->y > yoffset + 2000) { //respawn enemy plane spr->y = yoffset - 1000 - rand() % 1000; spr->alive++; spr->x = rand() % WIDTH; } //warps y from bottom to the top of the level if(spr->y < 0) { spr->y = 0; } else if( spr->y > 48000) { spr->y = 0; } } void displayprogress(int life) { int n; //draw the empty bar draw_sprite(buffer, progress, 490, 15); //fill up the bar with energy for(n = 0; n < life; n++) { draw_sprite(buffer, bar, 492+n*5, 17); } } void updateenemyplanes() { int n; int c = 0; //update/draw enemy planes for(n = 0; n < MAX_ENEMIES; n++) { if(enemy_planes[n]->alive) { c++; updatesprite(enemy_planes[n]); bouncex_warpy(enemy_planes[n]); fireatplayer(enemy_planes[n]); //is plane visible on screen if(enemy_planes[n]->y > yoffset-32 && enemy_planes[n]->y < yoffset + HEIGHT + 32) { //draw enemy planes on screen draw_sprite(buffer, enemy_plane_images[enemy_planes[n]->curframe], enemy_planes[n]->x, enemy_planes[n]->y - yoffset); } } //reset plane else { enemy_planes[n]->alive++; enemy_planes[n]->x = rand() % 100 + 50; enemy_planes[n]->y = yoffset - 2000 + rand() % 2000; } } //textprintf_ex(buffer, font, 0, 470, WHITE, -1, "Enemies %d", c); } void updatescroller() { //make sure it doesnt scroll beyond map edge if(yoffset < 5) { //level is over yoffset = 5; textout_centre_ex(buffer, font, "END OF LEVEL", SCREEN_W/2, SCREEN_H/2, WHITE, -1); } if(yoffset > BOTTOM) yoffset = BOTTOM; //scroll map up 1 pixel yoffset -= 1; //Draw the map with single layer MapDrawBG(buffer, 0, yoffset, 0, 0, SCREEN_W-1, SCREEN_H-1); } void updateplayer() { int n, x, y, x1, y1, x2, y2; //update/draw player sprite updatesprite(player); draw_sprite(buffer, player_images[player->curframe], player->x, player->y); //check for collision x = player->x + player->width/2; y = player->y + player->height/2; for(n = 0; n < MAX_ENEMIES; n++) { if(enemy_planes[n]->alive) { x1 = enemy_planes[n]->x; y1 = enemy_planes[n]->y - yoffset; x2 = x1 + enemy_planes[n]->width; y2 = y1 + enemy_planes[n]->height; if(inside(x, y, x1, y1, x2, y2)) { enemy_planes[n]->alive = 0; play_sample(sounds[2], volume, pan, pitch, FALSE); if(health > 0) { health--; } bigexp->alive++; bigexp->x = player->x; bigexp->y = player->y; score++; } } } } void checkinput() { //check for keyboard input if(key[KEY_UP]) { player->y -= 1; if(player->y < 100) player->y = 100; } if(key[KEY_DOWN]) { player->y += 1; if(player->y > HEIGHT - 65) player->y = HEIGHT - 65; } if(key[KEY_LEFT]) { player->x -= 1; if(player->x < 0) player->x = 0; } if(key[KEY_RIGHT]) { player->x += 1; if(player->x > WIDTH - 65) player->x = WIDTH-65; } if(key[KEY_SPACE]) { if(firecount > firedelay) { firecount = 0; fireatenemy(); play_sample(sounds[0], volume, pan, pitch, FALSE); } } } void initialize() { //initialize the program allegro_init(); install_timer(); install_keyboard(); set_color_depth(16); //set the screen int ret = set_gfx_mode(GFX_SAFE, 640, 480, 0, 0); if(ret != 0) { allegro_message("Error loading screen"); return; } srand(time(NULL)); //Install the sound system if((install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, "") != 0)) { allegro_message("Failed to load sound system"); } //Create the double buffer buffer = create_bitmap(SCREEN_W, SCREEN_H); clear_bitmap(buffer); //Load the mappy file int check = MapLoad("level1.fmp"); if(check != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Could not load level1.fmp"); return; } //Set an 8 bit pallete MapSetPal8(); //create gameover screen gameend = create_bitmap(SCREEN_W, SCREEN_H); clear_to_color(gameend, BLUE); textout_ex(gameend, font, "Game Over", SCREEN_W/2 - 50, SCREEN_H/2 - 20, WHITE, -1); } void endgame(int &health, int &score) { if(health == 0) { play_sample(sounds[4], volume, pan, pitch, FALSE); textprintf_ex(gameend, font, SCREEN_W/2 - 50, SCREEN_H/2 - 5, WHITE, -1, "Score: %d", score); blit(gameend, buffer, 0, 0, 0, 0, SCREEN_W, SCREEN_H); } } void loadsounds() { sounds[0] = load_sample("Gun_Shot.wav"); sounds[1] = load_sample("enemyexplosion.wav"); sounds[2] = load_sample("playerdamaged.wav"); sounds[3] = load_sample("enemygun.wav"); sounds[4] = load_sample("playerdead.wav"); sounds[5] = load_sample("seashore2.wav"); }
heres the mian.cpp
//Variables that help us determine the frames per second
int fps = 0;
int frames_done = 0;
int old_time = 0;
//Timer variables
volatile long ticks = 0;
volatile int game_time = 0;
//Interrupt handler functions
void ticker()
{
ticks++;
}
END_OF_FUNCTION(ticker)
void game_time_ticker()
{
game_time++;
}
END_OF_FUNCTION(game_time_ticker)
//Amount of times a ticker is called per second
const int updates_per_second = 180;
//displays the stats
void displaystats()
{
//display some status information
textprintf_ex(buffer, font, 0, 410, WHITE, -1, "Life %d", health);
textprintf_ex(buffer, font, 0, 420, WHITE, -1, "Firing rate %d", firedelay);
textprintf_ex(buffer, font, 0, 440, WHITE, -1, "Yoffset %d", yoffset);
textprintf_ex(buffer, font, 0, 460, WHITE, -1, "Framerate %d", fps);
//display score
textprintf_ex(buffer, font, 22, 22, GRAY, -1, "SCORE: %d", score);
textprintf_ex(buffer, font, 20, 20, RED, -1, "SCORE: %d", score);
}
int main()
{
int n;
//Intialize the game
initialize();
//indetify variables used by interupt funtions and lock them
LOCK_VARIABLE(ticks);
LOCK_VARIABLE(game_time);
LOCK_FUNCTION(ticker);
LOCK_FUNCTION(game_time_ticker);
//create new interupt handler
install_int_ex(ticker, BPS_TO_TIMER(updates_per_second));
install_int_ex(game_time_ticker, BPS_TO_TIMER(10));
//Load in all the sprites
loadsprite();
//load in all the sounds
loadsounds();
play_sample(sounds[5], 200, pan, pitch, TRUE);
//Start the main game loop
while(!key[KEY_ESC])
{
while(ticks == 0)
{
rest(100 / updates_per_second);//rest until a full tick has passed
}
while(ticks > 0)
{
int old_ticks = ticks;
//check if the player is interacting with the controls
checkinput();
//draw/update the map to the buffer
updatescroller();
//update and draw the enemy and player
updateplayer();
updateenemyplanes();
//draw and update the bullets
updatebullets();
updateenemybullets();
//draw and update the explosions
updateexplosions();
//draw and update bonuses and
//apply its effects on players if it collideds
updatebonuses();
//display health
displayprogress(health);
//display the stats
displaystats();
//check if the game needs to end
endgame(health, score);
ticks--;
if(old_ticks <= ticks)//logic is taking too long: abort and draw a frame
break;
}
//if a second has passed since we last measured the frame rate
if(game_time - old_time >= 10)
{
fps = frames_done;
//fps now holds the the number of frames done in the last second
//you can now output it using textout_ex et al
//textprintf_ex(buffer, font, 0, 460, WHITE, -1, "Framerate %d", fps);
//reset for next second
frames_done = 0;
old_time = game_time;
}
//blit the double buffer
acquire_screen();
blit(buffer, screen, 0, 0, 0, 0, SCREEN_W-1, SCREEN_H-1);
release_screen();
frames_done++;// we drew a frame
firecount++;
}
//delete mappy level
MapFreeMem();
//delete bitmaps
destroy_bitmap(buffer);
destroy_bitmap(progress);
destroy_bitmap(bar);
for(n = 0; n < 6; n++)
{
destroy_bitmap(explosion_images[n]);
}
for(n = 0; n < 3; n++)
{
destroy_bitmap(player_images[n]);
//destroy_bitmap(bullet_images[n]);
destroy_bitmap(enemy_plane_images[n]);
//destroy_bitmap(enemy_bullet_image);
}
//delete the sprite pointers
delete player;
for(n = 0; n < MAX_EXPLOSIONS; n++)
{
delete explosions[n];
}
for(n = 0; n < MAX_BULLETS; n++)
{
delete bullets[n];
}
for(n = 0; n < MAX_ENEMIES; n++)
{
delete enemy_planes[n];
}
for(n = 0; n < MAX_ENEMY_BULLETS; n++)
{
delete enemy_bullets[n];
}
allegro_exit();
return 0;
}
END_OF_MAIN()