![]() |
|
[Python] Iterating through a list of objects - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Python] Iterating through a list of objects (/showthread.php?tid=6049067) |
Iterating through a list of objects - Bora or Hyuna - Feb 13, 2020 Hi there, I am trying to iterate through a list of objects, what I want to do is if only 1 object in the list returns true, the program should continue until all the other objects return True. Here is my update method: Code def next_frame(self):Here is my method for returning a boolean value: Code def done(self):RE: Iterating through a list of objects - lockhead - Feb 13, 2020 Without more code I can't say for sure but I think what you're doing is setting a global variable "finish" to the result of this condition PHP Code So if this is true then finish will also be set to true and i presume finish is the control variable that stops the main loop for something. So I guess change the condition so that it fits your goal, I dont really know how tho since I don't really understand without any context. RE: Iterating through a list of objects - Bora or Hyuna - Feb 14, 2020 (Feb 13, 2020 11:09 AM)lockhead Wrote: Without more code I can't say for sure but I think what you're doing is setting a global variable "finish" to the result of this condition A friend of mine was able to help me yesterday and it finally works all I needed was to remove the explosions from the list after it was done. My god the solution was so simple. |