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 a cancelled delayed handler #26

Open clempo2 opened 1 year ago

clempo2 commented 1 year ago

This test case demonstrates SkeletonGame can call a cancelled delayed handler if the delayed handler was cancelled 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 DemoDelay(Mode):
    def mode_started(self):
        self.delay(name='delay1', event_type=None, delay=0, handler=self.delay1)
        self.delay(name='delay2', event_type=None, delay=0, handler=self.delay2)

    def delay1(self):
        self.cancel_delayed('delay2')
        print 'DemoDelay delay1'

    def delay2(self):
        self.cancel_delayed('delay1')
        print 'DemoDelay delay2'