SFML community forums

Help => Graphics => Topic started by: MrBigRig on November 29, 2014, 11:52:04 pm

Title: Removing instances from the game
Post by: MrBigRig on November 29, 2014, 11:52:04 pm
I have just begun to use SFML and i am still a noob, so forgive me if the answer is obvious

my problem is that i cant find a way to remove shapes from the game(e.g. if a shape goes outside the game world it should destroy itself)

i have searched google and these forums but couldn't find anything.
if you know any solutions or links to solutions please leave them bellow

i am using visual c++ express 10 and sfml 2.1
Title: Re: Removing instances from the game
Post by: Gambit on November 30, 2014, 03:45:17 am
It depends how you are creating and storing them and what you mean by "destroy". The simplest way would probably be to use a vector then check each shape's position.
Title: Re: Removing instances from the game
Post by: Nexus on November 30, 2014, 10:44:37 am
http://en.sfml-dev.org/forums/index.php?topic=14533
http://en.sfml-dev.org/forums/index.php?topic=14507
http://en.sfml-dev.org/forums/index.php?topic=5664

In short: use the STL. If you're not familiar with it, invest some time to study it deeply, it's crucial in C++.