Hi.
I'm writing a game, and now is the time for discovering when armies bumps into each other.

So with a lot of Army objects (subclass of QGraphicsItems) moving around, I thought about doing like this (psudocodish)

Qt Code:
  1. void Army::move()
  2. {
  3. while ( movement path not empty)
  4. {
  5. setPos( next position in path);
  6. list = collidingItems();
  7. foreach (item,list)
  8. {
  9. if (item == enemy) do stuff etc.
  10. else if ....
  11. }
  12. }
  13. }
To copy to clipboard, switch view to plain text mode 

Any other way of doing this that I haven't thought about?

I should add that there will always be atleast one item that I collide with, and that is the background map that is inserted as an QGraphicsPixmap, and that might slow things down? What do you think?
Is there any betterway of putting a pixmap as background in a scene?