MCPcopy Create free account
hub / github.com/ActiveState/code / enShotMove

Function enShotMove

recipes/Python/580636_Space_Assault/recipe-580636.py:1286–1319  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1284 cycle += 1
1285
1286 def enShotMove():
1287 global gameover
1288 if gameover != 1:
1289 self.after(10,enShotMove)
1290 cycle = 0
1291 for self.enShot in enShots:
1292 enDestroy = -1
1293 if enShotDir[cycle] == "N":
1294 enShotsYpos[cycle] -= 10
1295 elif enShotDir[cycle] == "E":
1296 enShotsXpos[cycle] += 10
1297 elif enShotDir[cycle] == "S":
1298 enShotsYpos[cycle] += 10
1299 elif enShotDir[cycle] == "W":
1300 enShotsXpos[cycle] -= 10
1301 self.enShot.place(x=enShotsXpos[cycle],y=enShotsYpos[cycle])
1302 #Game Over
1303 if Xpos + 30 >= enShotsXpos[cycle] >= Xpos - 10 and Ypos + 30 >= enShotsYpos[cycle] >= Ypos - 10:
1304 enDestroy = 0
1305 self.enShot.destroy()
1306 del enShots[cycle]
1307 del enShotsXpos[cycle]
1308 del enShotsYpos[cycle]
1309 del enShotDir[cycle]
1310 GameOver()
1311 #Destroy Shot at Boundary
1312 if enDestroy == -1:
1313 if enShotsXpos[cycle] < 0 or enShotsXpos[cycle] > 830 or enShotsYpos[cycle] < 0 or enShotsYpos[cycle] > 680:
1314 self.enShot.destroy()
1315 del enShots[cycle]
1316 del enShotsXpos[cycle]
1317 del enShotsYpos[cycle]
1318 del enShotDir[cycle]
1319 cycle += 1
1320
1321 def destroyEnemy():
1322 destroyed = 0

Callers 5

PauseFunction · 0.85
SinglePlayerFunction · 0.85
MultiPlayerFunction · 0.85

Calls 5

GameOverFunction · 0.85
rangeFunction · 0.85
afterMethod · 0.45
placeMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected