so i want to create a waiting method in my run-time of game for specifics. example, a 10 second period between when you can open door and close door…
i try to use sleep by this code:
import time time.sleep(5)
but this causes bge to lag terribly to a point where it basically crash…
so then I think, i will write method that takes in time, then loops for as long as time is multiplied by 60 (for 60 logic ticks per second)
wait(seconds): j = 0 for x in range(seconds * 60): j += 1 print(j)
the code above does loop through the correct amount of times, as proven by the debug print statements in the code (the statements involving variable j). however, it does not seem to actually wait that long, as i can open and close door instantly regardless of loop method. my thinking was… call to method would keep code “trapped” inside it and teh loop for all of loop time… but clearly my understanding is wrong. can somebody tell me correct way to use?