Sign in to follow this  
Nuwb1

Help on spaceshooter Game

Recommended Posts

Hey I am making a spaceshooter game, but somehow my vector's keep crashin the game. The vector is used on shooting, enemies and lives. Anything else i can use other than Vector? and anywhere there is a guide to use them? Thanks for yer help

Share this post


Link to post
Share on other sites
It depends on the vector you are using (STL vectors, 2D, 3D?) If you post some code of where you are crashing and a little more detailed explanation, perhaps we can help.

Share this post


Link to post
Share on other sites
Unhandled exception at 0x7c812a5b in lesson19.exe: Microsoft C++ exception: std::out_of_range at memory location 0x0012f9cc..

tatic void _Xran()
{ // report an out_of_range error
_THROW(out_of_range, "invalid vector<T> subscript");
}

The first one is an errorbox that appears
The second thing is what is wrong i think, a window of vector library or sommet pops up and a green arrow points to that one,

struct vasp
{
float x ; // vasp X position
float y ; // vasp Y position
float vaspmoveX ; // vasp X movement
float vaspmoveY ; // vasp Y movement
float ShootAngle; // vasps x value when firing
};
struct Enemystinger
{
float StingerXpos ;
float StingerYpos ;
};
struct life
{
float Lxpos ;
float Lypos ;
};
std::vector <vasp> Enemy ;
std::vector <Enemystinger> Stinger ;
std::vector <life> Liv ;

this helps?

Share this post


Link to post
Share on other sites
Vectors aren't crashing your app.. YOU are ;-).

Looks like you're trying to access something that's out of range in your vector, probably using the '[]' operator. Find out exactly what line your app is crashing on. Is it possible that you're indexing from 1 instead of from 0 or something?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this