> One good approach is to have a separate function or method with > both loops: > > def attack(self, Enemy): > > for missile in self.missiles: > for rect in Enemy.rects: > if QPoint(missile.x + 5, missile.y) in rect: > explosion = Explosion(rect.x(), rect.y()) > self.explosions.append(explosion) > return
i altered this because once it returns the outer loop also stops and i need it incase i have more than 1 missile to loop through. i made it so i did the outer loop in the program and sent the inner loop to this function, but for some reason the code seems to break my program.. no errors are returned but it just freezes on inputs and missile collision. > You could also set a flag and check it at the end of outer loop > and have a second break statement when the flag is set. > im trying to figure out this technique with flags but i havent got it yet.. what does a flag stand for? _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor