I have a panda program that simply calls other tasks like so:
from direct.showbase.ShowBase import ShowBase
from direct.gui.DirectGui import *
from GameObject import Player
class Game(ShowBase):
def __init__(self,manager=None,size=None,apppath=None):
ShowBase.__init__(self)
self.players = {'primary': Player()}
self.enemies = {}
taskMgr.add(self.update,"update-whole-game")
def update(self,task):#get size, update size if it changes, but update that here
dt = globalClock.getDt()
for player in self.players.keys():
taskMgr.add(self.players[player].update, f'update-{player}',extraArgs=[dt],appendTask=True)
task.cont
if __name__ == "__main__":
game = Game()
game.run()
And GameObject looks like this:
class Player():
def update(self,dt,task):
print("hey one thousand times")
task.done
From what I understand, in this code, it should print "hey one thousand times" quite a few times as it's continually being called. Why is Player.update()
only being called once?