Exemple #1
0
 def createAlienSpacShip(self,canvas:'Canvas Tkinter') -> Game:
     alienSpaceShip = Object('AlienSpaceShip', 50,50,25,'red',score=randint(1,4)*50)
     (x1, y1, x2, y2) = alienSpaceShip.getIdBox()
     size = x2-x1
     alienSpaceShip.setDraw(canvas.create_polygon(x1, y1, x2, y2, x1, y1+0.2*size, x2, y2-size*0.5, x1, y2, fill=alienSpaceShip.getColor()))
     self.addAlienSpaceShip(alienSpaceShip)
     return self
Exemple #2
0
 def createMissileAlien(self,x:int, y:int, canvas:'Canvas Tkinter') -> Game:
     missileAlien = Object('MissileAlien', x,y,25,'black')
     (x1, y1, x2, y2) = missileAlien.getIdBox()
     missileAlien.setDraw(canvas.create_rectangle(x1, y1, x1+3, y2, fill=missileAlien.getColor()))
     self.addMissileAlien(missileAlien)
     return self
Exemple #3
0
 def createMissile(self,x:int, canvas:'Canvas Tkinter') -> Game:
     missile = Object('Missile', x,700,25,'grey')
     (x1, y1, x2, y2) = missile.getIdBox()
     missile.setDraw(canvas.create_oval(x1, y1, x2, y2, fill=missile.getColor()))
     self.addMissile(missile)
     return self