Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def timing():
- global g_direction
- global timeBegin
- global timeNow
- global moveTime
- if g_direction!=None:
- timeNow = time.time()
- moveTime=timeNow-timeBegin
- screen.ontimer(timing,500)
- def title():#including contact&timer
- global contacting
- global caught
- global moveTime
- #turtle.title("Snake: Contacted: %d Time: %d"%(contact(),timing())
- turtle.title("Snake: Contact: %d Time: %d" %(contacting,moveTime))
- if caught==True:
- return
- if len(head.stampItems)==50:
- return
- screen.ontimer(title,500)#speed=contact
- def Game(m,n):
- global caught
- global timeBegin
- text.clear()
- setFood()
- screenControl()
- timeBegin=time.time()
- snakeMove()
- monsterMove()
- contact()
- timing()
- title()
- if __name__ == "__main__":
- setWrite()
- setSnake()
- setMonster()
- screen.onclick(Game)
- screen.listen()
- screen.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement