| | |
GA.exe has encountered an error and needs to close
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2009
Posts: 7
Reputation:
Solved Threads: 0
Hi.
Firstly, I am a complete noob, and cannot understand complicated answers.
OK. I'm making a noobish space game, called Galactic Armageddon.
I'm just testing the variables right now (for getting hit by lasers, missiles, etc.).
I'm compiling using Dev-C++ and the default compiler. The program is written using the Allegro game library (see cppgameprogramming.com)
When I run the executable, I get an error saying:
GA.exe has encountered a problem and needs to close.
It says this straight away, without even opening a window or anything.
Here is the code so far:
Please help me!
Thanks
Mark
Firstly, I am a complete noob, and cannot understand complicated answers.
OK. I'm making a noobish space game, called Galactic Armageddon.
I'm just testing the variables right now (for getting hit by lasers, missiles, etc.).
I'm compiling using Dev-C++ and the default compiler. The program is written using the Allegro game library (see cppgameprogramming.com)
When I run the executable, I get an error saying:
GA.exe has encountered a problem and needs to close.
It says this straight away, without even opening a window or anything.
Here is the code so far:
C++ Syntax (Toggle Plain Text)
#include <cstdlib> #include <iostream> #include <allegro.h> using namespace std; int bullethit = 0; int health = 100; int shield = 10; int maxshield = 10; int armour = 10; int maxarmour = 10; int dir = 0; int weapon = 0; bool shieldsup = true; bool armourup = true; bool dead = false; bool running = true; void ship(){ if (dir < 0) { dir=360; } else if (dir > 360) { dir=0; } if (bullethit==1 && shieldsup==false && armourup==false) { health = health - 10; bullethit = false; } if (bullethit==1 && shieldsup==false && armourup==true) { armour = armour - 5; bullethit = false; } if (bullethit==1 && shieldsup==true) { shield = shield - 4; bullethit = false; } if (bullethit==2 && shieldsup==false && armourup==false) { health = health - 20; bullethit = false; } if (bullethit==2 && shieldsup==false && armourup==true) { armour = armour - 10; bullethit = false; } if (bullethit==2 && shieldsup == true) { shield = shield - 8; bullethit = false; } if (bullethit==3 && shieldsup==false && armourup==false) { health = health - 30; bullethit = false; } if (bullethit==3 && shieldsup==false && armourup==true) { armour = armour - 15; bullethit = false; } if (bullethit==3 && shieldsup==true) { shield = shield - 12; bullethit = false; } if (bullethit==4 && shieldsup==false&&armourup==false) { health = health - 40; bullethit = false; } if (bullethit==4 && shieldsup==false&&armourup==true) { armour = armour - 20; bullethit = false; } if (bullethit==4 && shieldsup) { shield = shield - 17; bullethit = false; } if (bullethit==5 && shieldsup==false&&armourup==false) { health = health - 45; bullethit = false; } if (bullethit==5 && shieldsup==false&&armourup==true) { armour = armour - 22; bullethit = false; } if (bullethit==5 && shieldsup==true) { shield = shield - 20; } if (bullethit==6) { shield =0; armour =0; health =0; } if (health==0) { dead=true; } if (armour==0) { armourup = false; } if (shield==0) { shieldsup = false; } if (dead==true) { clear_to_color( screen, makecol( 0, 0, 0)); textout_ex( screen, font, "You are dead!", 320, 240, makecol( 255, 0, 0), makecol( 0, 0, 0));; } if (armourup==false) { clear_to_color( screen, makecol( 0, 0, 0)); textout_ex( screen, font, "No more armour!", 320, 240, makecol( 255, 0, 0), makecol( 0, 0, 0));; } if (shieldsup==false) { clear_to_color( screen, makecol( 0, 0, 0)); textout_ex( screen, font, "No more shields!", 320, 240, makecol( 255, 0, 0), makecol(0, 0, 0));; } while (!key[KEY_ESC]){ clear_to_color( screen, makecol(0, 0, 0)); textout_ex( screen, font, "Shields: " + shield, 320, 240, makecol(255, 0, 0), makecol(0, 0, 0));; textout_ex( screen, font, "Armour : " + armour, 320, 230, makecol(255, 0, 0), makecol(0, 0, 0));; textout_ex( screen, font, "Health: " + health, 320, 220, makecol(255, 0, 0), makecol(0, 0, 0));; } } void testattack(){ int weapon; cout<<"1=laser 2=cannon 3=part 4=missile 5=homing 6=NUKE"<<endl; cin>>weapon; bullethit=weapon; ship(); } #undef main int main(int argc, char* argv[]){ while(running==true) { testattack(); } return 0; }
Please help me!
Thanks
Mark
![]() |
Similar Threads
- Explorer.Exe - Application Error (Windows NT / 2000 / XP)
- Problems: TrojanDownloader:Win32/Renos.DX with b.exe application error (Windows NT / 2000 / XP)
- MSN messenger has encountered an error and needs to close (Viruses, Spyware and other Nasties)
- Windows Live Messenger has encountered a problem and needs to close. (Viruses, Spyware and other Nasties)
- Internet Explorer has encountered a problem and needs to close - when I close IE (Windows NT / 2000 / XP)
- nwiz.exe error message (Windows NT / 2000 / XP)
- Error message when executing stand-alone applications(apps with no dll files etc.) (Windows NT / 2000 / XP)
- IE has encountered an error and must close (Web Browsers)
- What Should I Do Next? (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: Another [Linker error] undefined reference to `WinMain@16'
- Next Thread: How to display items that user entered that stored in array??
| Thread Tools | Search this Thread |
429 ad advertising api application array backup bandwidth beginner binary bitmap blue bmp c# c++ char char* cio class code console development dialog dns download earth email embed encryption engine error exam faq file fstream function functions game gdi+ gmail google graph gui html input insert int introduction java javac jni lindacureton linker linux lnk2019 management math method nasa news output parse pause php port problem program programming python qt read recursion recursive registry richedit screen search sell send small software space string struct subclass syntax template text toolkit tree universe unlimited url usgovernment vb vista visual win32 windows wxwidgets






