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

Author Topic: What now ?  (Read 7116 times)

0 Members and 2 Guests are viewing this topic.

Samyboy

  • Newbie
  • *
  • Posts: 19
    • View Profile
What now ?
« Reply #15 on: February 06, 2010, 02:08:05 pm »
Hello,

So the collision detection is working pretty fine, thanks for your help!

I bumped into another question tho:

How would you go on and save/move all the projectiles? I currently save them all into a vector and move them in the game loop every frame. Is that a good way of doing it? Are there better ways?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
What now ?
« Reply #16 on: February 06, 2010, 03:04:19 pm »
Quote from: "Samyboy"
How would you go on and save/move all the projectiles? I currently save them all into a vector and move them in the game loop every frame. Is that a good way of doing it?
Yes, that's certainly a good way. Whether it is the optimal one, depends on the operations needed on the container. But in general, std::vector is a good choice.

For example, you can perform constant time removals if you swap positions with the last element (because pop_back() has O(1)).
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything