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

Function Pause

recipes/Python/580636_Space_Assault/recipe-580636.py:1650–1706  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

1648 SinglePlayer()
1649
1650 def Pause(event):
1651 global pause
1652 global gameover
1653 global waveTime
1654 if pause == 0:
1655 gameover = 1
1656 pause = 1
1657 self.unbind('<Left>')
1658 self.unbind('<Right>')
1659 self.unbind('<Up>')
1660 self.unbind('<Down>')
1661 self.unbind('<space>')
1662 self.after_cancel(EnemyMove)
1663 self.after_cancel(Enemy2Move)
1664 self.after_cancel(Enemy3Move)
1665 self.after_cancel(Enemy4Move)
1666 self.after_cancel(Enemy5Move)
1667 self.after_cancel(CreateEnemy)
1668 self.after_cancel(CreateEnemy2)
1669 self.after_cancel(CreateEnemy3)
1670 self.after_cancel(CreateEnemy4)
1671 self.after_cancel(CreateEnemy5)
1672 self.after_cancel(CreateEnemy6)
1673 self.after_cancel(Generate)
1674 self.after_cancel(NextWave)
1675 self.after_cancel(ShotMove)
1676 self.after_cancel(enShotMove)
1677 for self.shot in Shots:
1678 self.shot.destroy()
1679 self.lbScore.destroy()
1680 self.lbPause = Label(text="Paused"+"\n"+"Press 'p' to Unpause",bg="black",fg="white")
1681 self.lbPause.pack(fill=BOTH,expand=1)
1682 self.btnMainMenu = Button(text="Main Menu")
1683 self.btnMainMenu.pack(side=LEFT)
1684 self.btnMainMenu.bind('<Button>',StartMainMenu)
1685 elif pause == 1:
1686 gameover = 0
1687 pause = 0
1688 self.bind('<Left>',LeftKey)
1689 self.bind('<Right>',RightKey)
1690 self.bind('<Up>',UpKey)
1691 self.bind('<Down>',DownKey)
1692 self.bind('<space>',Shoot)
1693 EnemyMove()
1694 Enemy2Move()
1695 Enemy3Move()
1696 Enemy4Move()
1697 Enemy5Move()
1698 Generate()
1699 ShotMove()
1700 enShotMove()
1701 self.lbScore = Label(text="Wave: "+str(wave)+" Next Wave: "+str(waveTime/1000)+"sec Press 'p' to pause",bg="black",fg="white")
1702 self.lbScore.place(x=165,y=680,width=500,height=20)
1703 NextWave()
1704 self.lbPause.destroy()
1705 self.btnMainMenu.unbind('<Button>')
1706 self.btnMainMenu.destroy()
1707

Callers

nothing calls this directly

Calls 15

LabelClass · 0.85
EnemyMoveFunction · 0.85
Enemy2MoveFunction · 0.85
Enemy3MoveFunction · 0.85
Enemy4MoveFunction · 0.85
Enemy5MoveFunction · 0.85
GenerateFunction · 0.85
ShotMoveFunction · 0.85
enShotMoveFunction · 0.85
strFunction · 0.85
NextWaveFunction · 0.85
ButtonClass · 0.50

Tested by

no test coverage detected