Example #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()
Example #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()
Example #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()
Example #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()
Example #5
0
File: worm.py Project: 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()
Example #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()
Example #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
Example #8
0
File: worm.py Project: 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
Example #9
0
 def run(self):
     """ Run the controller """
     self.application.addWidget(self.window)
     self.application.setCurrentWidget(self.window)
     TheGameEngine.start(self.window, self)
Example #10
0
 def defuse(self):
     """ Defuse the current cell """
     self.powerRating.usePower(DEFUSE_POWER)
     self.minefield.defuse(self.row, self.column, self)
     TheGameEngine.updateUI()
Example #11
0
 def performEMP(self):
     """ Performan EMP Blast """
     self.powerRating.usePower(EMP_POWER)
     self.minefield.performEMP(self.row, self.column, self)
     TheGameEngine.updateUI()
Example #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()
Example #13
0
 def defuse(self):
     """ Defuse the current cell """
     self.powerRating.usePower(DEFUSE_POWER)
     self.minefield.defuse(self.row, self.column, self)
     TheGameEngine.updateUI()
Example #14
0
 def scan(self):
     """ Scan the current cell """
     self.powerRating.usePower(SCAN_POWER)
     self.minefield.scan(self.row, self.column, self)
     TheGameEngine.updateUI()
Example #15
0
 def scan(self):
     """ Scan the current cell """
     self.powerRating.usePower(SCAN_POWER)
     self.minefield.scan(self.row, self.column, self)
     TheGameEngine.updateUI()
Example #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()
Example #17
0
 def performEMP(self):
     """ Performan EMP Blast """
     self.powerRating.usePower(EMP_POWER)
     self.minefield.performEMP(self.row, self.column, self)
     TheGameEngine.updateUI()