I wrote this script for my classmates where we shoot at each other, but after it compiles it says that there was an error and exits out. heres my script, if there is anything in there that needs to be fixed please help me.
#include <allegro.h>
#include <process.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
bool Indian;
int x;
int y;
int Score = 0;
int Timer;
BITMAP* Switch;
int GeneratePicture();
void Menu();
void Fire();
void Time(void* ISeeYou);
void UpdateScreen(void* Hi_Zach);
int main(){
allegro_init();
install_keyboard();
install_mouse();
install_keyboard();
set_color_depth(16);
install_sound (DIGI_AUTODETECT, MIDI_AUTODETECT, "A");
set_gfx_mode( GFX_AUTODETECT, 1280, 960, 0, 0);
Menu();
_beginthread( UpdateScreen, 0, 0);
_beginthread( Time, 0, 0);
while(!key[KEY_ESC] || !Timer == 0){
GeneratePicture();
Fire();
}
}
END_OF_MAIN();
void Menu(){
BITMAP* Menu = load_bitmap("Menu", NULL);
draw_sprite(screen, Menu, 0, 0);
readkey();}
int GeneratePicture(){
int RandomPic;
srand ( time(NULL) );
RandomPic = rand() % 10 + 1;
x = rand() % 1180 + 1;
y = rand() % 860 + 1;
if (RandomPic == 1 || RandomPic == 2 || RandomPic == 3){
Switch = load_bitmap("Kyie1", NULL);}
if (RandomPic == 4 || RandomPic == 5 || RandomPic == 6){
Switch = load_bitmap("Kyie2", NULL);}
if (RandomPic == 7 || RandomPic == 8 || RandomPic == 9){
Switch = load_bitmap("Kyie3", NULL);}
if (RandomPic == 10){
Switch = load_bitmap("Indian", NULL);
Indian = true;}
return 0;
}
void UpdateScreen(void* Hi_Zach){
BITMAP* Background = load_bitmap("Background", NULL);
BITMAP* Buffer = create_bitmap(1280, 960);
while(!key[KEY_ESC] || !Timer == 0){
draw_sprite(Buffer, Background, 0, 0);
draw_sprite(Buffer, Switch, x, y);
line( Buffer, mouse_x, 0, mouse_x, 960, makecol( 0, 0, 0));
line( Buffer, 0, mouse_y, 1280, mouse_y, makecol( 0, 0, 0));
textprintf_ex(Buffer, font, 0, 0, makecol(0,0,0), -1, "Score: %i Time: %i", Score, Timer);
draw_sprite(screen, Buffer, 0, 0);
rest(100);}
_endthread();}
void Time(void *ISeeYou){
Timer = 30;
while(Timer != 0){
rest(1000);
Timer--;
}
_endthread();
}
void Fire(){
SAMPLE *Boom = load_sample ("BOOM.wav");
bool hit = false;
while(!hit){
rest(100);
if (mouse_b & 1 && mouse_x > x && mouse_x < x+100 && mouse_y > y && mouse_y < y+100){
hit=true;
play_sample (Boom, 100, 128, 1000, false);}}
if (Indian)Score=Score+25;
else Score=Score+10;}