Jump to content
  • Advertisement
Sign in to follow this  
Nuwb1

Help on spaceshooter Game

This topic is 4161 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!