Changeset 166:f99b094a3d5d
Legend:
- Unmodified
- Added
- Removed
-
main.py
r165 r166 ˆà 16 16 - 'step_id' - current step of the gameˆà 17 17 - 'after_id' - identificator of runing game processˆà 18 ˆà - 'step_legth' - fime of the step"""ˆà ˆà 18 - 'step_legth' - length of the step (in ms)ˆà ˆà 19 - 'game_length' - number of the steps in one round of the game"""ˆà 19 20 def __init__ (self):ˆà 20 21 """Create Python Battle game window.ˆà òÀæ òÀæ ˆà 29 30 self.after_id = Noneˆà 30 31 self.step_length = 150ˆà ˆà 32 self.game_length = 200ˆà 31 33 returnˆà 32 34 ˆà òÀæ òÀæ ˆà 76 78 def start (self):ˆà 77 79 """Init running of the game."""ˆà 78 ˆà if self.step_id == 666:ˆàˆà 80 if self.step_id == self.game_length + 666:ˆà 79 81 self.next_round()ˆà 80 82 if self.dead_snake_check() == False:ˆà 81 83 returnˆà 82 ˆà if self.step_id > 200:ˆàˆà 84 if self.step_id > self.game_length:ˆà 83 85 self.end()ˆà 84 86 returnˆà òÀæ òÀæ ˆà 99 101 if self.dead_snake_check() == False:ˆà 100 102 returnˆà 101 ˆà if self.step_id <= 200:ˆàˆà 103 if self.step_id <= self.game_length:ˆà 102 104 if self.after_id != None:ˆà 103 105 self.canvas.after_cancel(self.after_id)ˆà òÀæ òÀæ ˆà 141 143 self.canvas.after_cancel(self.after_id)ˆà 142 144 passˆà 143 ˆà self.step_id = 666ˆàˆà 145 self.step_id = self.game_length + 666ˆà 144 146 root = tk.Tk()ˆà 145 147 end_label = tk.Label(root, text="End")ˆà
Note: See TracChangeset
for help on using the changeset viewer.