Exemplo n.º 1
0
 def run(self):
     """ Run the controller """
     self.previousController = TheGameEngine.controller
     self.application.addWidget(self.window)
     self.application.setCurrentWidget(self.window)
     TheGameEngine.start(self.window, self)
     self.window.grabKeyboard()
Exemplo n.º 2
0
 def run(self):
     """ Run the controller """
     self.previousController = TheGameEngine.controller
     self.application.addWidget(self.window)
     self.application.setCurrentWidget(self.window)
     TheGameEngine.start(self.window, self)
     self.window.grabKeyboard()
Exemplo n.º 3
0
    def move(self, rowMovement, columnMovement):
        """ Move the drone """
        self.row += rowMovement
        self.column += columnMovement
        self.moveRating.move()

        square = self.minefield.getSquare(self.row, self.column)
        square.onMove(self)
        TheGameEngine.updateUI()
Exemplo n.º 4
0
 def move(self, rowMovement, columnMovement):
     """ Move the drone """
     self.row += rowMovement
     self.column += columnMovement
     self.moveRating.move()
     
     square = self.minefield.getSquare(self.row, self.column)
     square.onMove(self)
     TheGameEngine.updateUI()
Exemplo n.º 5
0
Arquivo: worm.py Projeto: cloew/PyMine
    def tryToAttack(self, drone):
        """ Try to have the worm attack the drone """
        if not self.attacking:
            self.attacking = self.droneInSquare(drone)

        if self.attacking:
            if (self.attackTick % self.cyclesToAttack) == 0:
                self.attack(drone)
                self.attacking = False
            self.attackTick %= self.cyclesToAttack
            self.attackTick += 1
            TheGameEngine.updateUI()
Exemplo n.º 6
0
 def tryToAttack(self, drone):
     """ Try to have the worm attack the drone """
     if not self.attacking:
         self.attacking = self.droneInSquare(drone)
     
     if self.attacking:
         if (self.attackTick % self.cyclesToAttack) == 0:
             self.attack(drone)
             self.attacking = False
         self.attackTick %= self.cyclesToAttack
         self.attackTick += 1
         TheGameEngine.updateUI()
Exemplo n.º 7
0
 def move(self, minefield):
     """ Move the worm in the minefield """
     adjacentSquares = minefield.getAdjacentSquares(self.gridSquare)
     
     while True:
         if len(adjacentSquares) == 0:
             break
         square = choice(adjacentSquares)
         if square.hasGroundDefense() or square.column == 0:
             adjacentSquares.remove(square) # Can't move to a square that already has ground content or is in the safe zone
         else:
             self.gridSquare.setGroundDefense(None)
             square.setGroundDefense(self)
             self.gridSquare = square
             TheGameEngine.updateUI()
             break
Exemplo n.º 8
0
Arquivo: worm.py Projeto: cloew/PyMine
    def move(self, minefield):
        """ Move the worm in the minefield """
        adjacentSquares = minefield.getAdjacentSquares(self.gridSquare)

        while True:
            if len(adjacentSquares) == 0:
                break
            square = choice(adjacentSquares)
            if square.hasGroundDefense() or square.column == 0:
                adjacentSquares.remove(
                    square
                )  # Can't move to a square that already has ground content or is in the safe zone
            else:
                self.gridSquare.setGroundDefense(None)
                square.setGroundDefense(self)
                self.gridSquare = square
                TheGameEngine.updateUI()
                break
Exemplo n.º 9
0
 def run(self):
     """ Run the controller """
     self.application.addWidget(self.window)
     self.application.setCurrentWidget(self.window)
     TheGameEngine.start(self.window, self)
Exemplo n.º 10
0
 def defuse(self):
     """ Defuse the current cell """
     self.powerRating.usePower(DEFUSE_POWER)
     self.minefield.defuse(self.row, self.column, self)
     TheGameEngine.updateUI()
Exemplo n.º 11
0
 def performEMP(self):
     """ Performan EMP Blast """
     self.powerRating.usePower(EMP_POWER)
     self.minefield.performEMP(self.row, self.column, self)
     TheGameEngine.updateUI()
Exemplo n.º 12
0
 def defuseCarefully(self):
     """ Carfeully defuse a Fragile mine """
     self.powerRating.usePower(CAREFUL_DEFUSE_POWER)
     self.minefield.defuseCarefully(self.row, self.column, self)
     TheGameEngine.updateUI()
Exemplo n.º 13
0
 def defuse(self):
     """ Defuse the current cell """
     self.powerRating.usePower(DEFUSE_POWER)
     self.minefield.defuse(self.row, self.column, self)
     TheGameEngine.updateUI()
Exemplo n.º 14
0
 def scan(self):
     """ Scan the current cell """
     self.powerRating.usePower(SCAN_POWER)
     self.minefield.scan(self.row, self.column, self)
     TheGameEngine.updateUI()
Exemplo n.º 15
0
 def scan(self):
     """ Scan the current cell """
     self.powerRating.usePower(SCAN_POWER)
     self.minefield.scan(self.row, self.column, self)
     TheGameEngine.updateUI()
Exemplo n.º 16
0
 def defuseCarefully(self):
     """ Carfeully defuse a Fragile mine """
     self.powerRating.usePower(CAREFUL_DEFUSE_POWER)
     self.minefield.defuseCarefully(self.row, self.column, self)
     TheGameEngine.updateUI()
Exemplo n.º 17
0
 def performEMP(self):
     """ Performan EMP Blast """
     self.powerRating.usePower(EMP_POWER)
     self.minefield.performEMP(self.row, self.column, self)
     TheGameEngine.updateUI()