Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Removing instances from the game  (Read 1267 times)

0 Members and 1 Guest are viewing this topic.

MrBigRig

  • Newbie
  • *
  • Posts: 2
    • View Profile
Removing instances from the game
« 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

Gambit

  • Sr. Member
  • ****
  • Posts: 283
    • View Profile
Re: Removing instances from the game
« Reply #1 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.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Removing instances from the game
« Reply #2 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++.
« Last Edit: November 30, 2014, 10:51:40 am by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything