Guest User

Minigame Template AI (DistributedCoolGameAI.py)

a guest
Jun 27th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.36 KB | None | 0 0
  1. from toontown.minigame.DistributedMinigameAI import *
  2. from direct.fsm import ClassicFSM, State
  3.  
  4. # PS: All the toons are kept on a list
  5. # self.avIdList
  6.  
  7. class DistributedCoolGame(DistributedMinigame):
  8.     def __init__(self, cr):
  9.         DistributedMinigame.__init__(self, cr)
  10.         # This is our game FSM, it defines all the states
  11.         # the minigame is going to have, eg. toon dies, toon wins, etc.
  12.         self.gameFSM = ClassicFSM.ClassicFSM(
  13.             'DistributedCoolGameAI', [
  14.             ]
  15.         )
  16.         self.addChildGameFSM(self.gameFSM)
  17.         # Here goes all your initial variables
  18.         self.happynessDict = {}
  19.        
  20.    
  21.     # You can include most of the client-side CoolGame
  22.     # state handles here too, even though they might not
  23.     # be useful in most cases.
  24.        
  25.     def enterPlay(self):
  26.         # The game has just started, let's keep track of when it's
  27.         # going to end so we can do our job of finishing it.
  28.         taskMgr.doMethodLater(3 * 60, self.timeout, self.taskName("minigameTimer"))
  29.        
  30.     def timeout(self, t):
  31.         # The game timed out, Minigame does
  32.         # all the further work.
  33.         self.gameOver()
  34.         return t.done
  35.        
  36.     def exitPlay(self):
  37.         # Handled exit, kill our task
  38.         taskMgr.remove(self.taskName("minigameTimer"))
Add Comment
Please, Sign In to add comment