mjocean / PyProcGameHD-SkeletonGame

The current HD VGA Fork of PyProcGame (w/ HW Accel) + SkeletonGame to accelerate new game development
http://pinballprogramming.com
MIT License
14 stars 8 forks source link

SkeletonGame can call mode_tick() on stopped modes #25

Open clempo2 opened 1 year ago

clempo2 commented 1 year ago

This test case demonstrates SkeletonGame can call mode_tick() on a stopped mode if the mode was removed within the same tick cycle. See https://github.com/clempo2/SkeletonGameDMD/commit/a3e6b6129a625f0b3e0ea637c872c1e3608c7a5b and https://github.com/clempo2/SkeletonGameDMD/commit/e0c45fe79090792e96685f1d2432d8dd7f69b078 for a possible solution.

from procgame.game import Mode
class DemoTick(Mode):
    def mode_started(self):
        self.delay(name='delay1', event_type=None, delay=0, handler=self.delay1)
    def mode_stopped(self):
        print 'DemoTick mode_stopped'
    def delay1(self):
        print 'DemoTick delay1'
        self.game.modes.remove(self)
    def mode_tick(self):
        print 'DemoTick mode_tick'