Exemplo n.º 1
0
    def __init__(self, screenSizeProduct=1):
        self.logShown = True
        self.PPM = 20.0 * screenSizeProduct
        self.FPS = 40.0
        self.ratio = screenSizeProduct
        self.TIME_STEP = 1.0 / self.FPS
        self.world = world(gravity=(0, -30), doSleep=True)  #The Box2D world
        self.elements = dict()
        self.ballID = None
        self.playerAID = None  #The ID of the player A element
        self.playerBID = None  #The ID of the player B element
        self.pitchIDs = []  #The IDs of the pitch elements

        self.playerA = None  #The ID of the playe A manager
        self.playerB = None  #The ID of the playe B manager

        self.ballColor = 200, 200, 200
        self.background = 100, 100, 255

        self.playerAHead = "Head A"  #head code
        self.playerBHead = "Head B"  #head code

        self.Log = []  #register of what happened
        self.width = 45
        self.height = 30
        self.CalculateHalfs()

        self.idCount = 0
        self.showThings = dict()
        self.idShowCount = 0

        self.counterGoalA = 0  #Used for the goal scored animation
        self.counterGoalB = 0

        self.targetAction = None  #Who will handle the goals
        self.AddLog("Starting game ...")

        self.scoreA = 0
        self.scoreB = 0
        self.time = 0
        self.scoreImageA = None
        self.scoreImageB = None
        self.timeImages = []
        self.pointsPoints = fonts.GetFont("VOM_30").render(
            ":", 1, (255, 255, 255))

        self.UpdateScoreAImage()
        self.UpdateScoreBImage()
        self.UpdateTimeImage()
        self.messages = dict()

        self.reference = 0
        self.stoped = 0
        self.playingClock = False
        self.status = "stoped"

        self.SetPlayerAName("Player A")
        self.SetPlayerBName("Player B")
        self.SetBackground(self.background)
Exemplo n.º 2
0
 def GenerateImage(self, color, font, content):
     return fonts.GetFont(font).render(content, 0, color)
Exemplo n.º 3
0
 def RenderTime(self, digit):
     self.timeImages.append(
         fonts.GetFont("VOM_30").render(str(digit), 1, (255, 255, 255)))
Exemplo n.º 4
0
 def UpdateScoreBImage(self):
     self.scoreImageB = fonts.GetFont("VOM_35").render(
         str(self.scoreB), 1, (255, 255, 255))
Exemplo n.º 5
0
 def SetPlayerBName(self, name):
     self.playerBName = name
     self.playerBNameSurface = fonts.GetFont("VOM_20").render(
         self.playerBName, 1, (255, 255, 255))
Exemplo n.º 6
0
def GenerateMsj(message):
    return fonts.GetFont("VOM_35").render(message, 1, (0, 0, 0))