Jump to content

  • Log In with Google      Sign In   
  • Create Account


LewisDe

Member Since 06 May 2013
Offline Last Active Aug 08 2013 06:47 AM
-----

Topics I've Started

Program crashes and vectors

06 August 2013 - 12:34 PM

Hey guys, I need your help. I'm creating a simple space game with SDL and I hold a vector of projectiles. Whenever I attempt to push_back() a new element, the game suddenly ends. Please forgive any n00b mistakes as I'm learning the ropes of C++. The code is posted here: http://pastebin.com/7NAv82Aa and the SpawnProjectile() function is located on line 243.

SDL C++ Program crashing

06 May 2013 - 05:18 AM

I have a bunny who shoots bullets. To ensure that resources aren't being depleted, the game erases that bullet from a vector of bullets when the bullet comes off the screen (when its x value is less than zero). However, whenever the game erases the obsolete bullet, the game ends abruptly. I think this problem has something to do with when the sprite resources are freed. Can anyone please help... sad.png

 

Code: http://pastebin.com/wG6rRqa8

 

The key lines to acknowledge are lines 441 and the projectile class


PARTNERS