Äîêóìåíò âçÿò èç êýøà ïîèñêîâîé ìàøèíû. Àäðåñ îðèãèíàëüíîãî äîêóìåíòà : http://kodomo.cmm.msu.su/trac/snake/changeset/166
Äàòà èçìåíåíèÿ: Unknown
Äàòà èíäåêñèðîâàíèÿ: Sun Apr 10 01:36:08 2016
Êîäèðîâêà: IBM-866
Changeset 166:f99b094a3d5d òÀÓ Python Battle

Changeset 166:f99b094a3d5d


Ignore:
Timestamp:
12/23/10 20:09:48 (5 years ago)
Author:
Alex Martynov
Branch:
default
Message:

Added UI.game_length as atribute

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main.py

    r165 r166 ˆà
    1616    - 'step_id' - current step of the gameˆà
    1717    - '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"""ˆà
    1920    def __init__ (self):ˆà
    2021        """Create Python Battle game window.ˆà
    òÀæ òÀæ ˆà
    2930        self.after_id = Noneˆà
    3031        self.step_length = 150ˆà
    ˆà32        self.game_length = 200ˆà
    3133        returnˆà
    3234    ˆà
    òÀæ òÀæ ˆà
    7678    def start (self):ˆà
    7779        """Init running of the game."""ˆà
    78ˆà        if self.step_id == 666:ˆà
    ˆà80        if self.step_id == self.game_length + 666:ˆà
    7981            self.next_round()ˆà
    8082        if self.dead_snake_check() == False:ˆà
    8183            returnˆà
    82ˆà        if self.step_id > 200:ˆà
    ˆà84        if self.step_id > self.game_length:ˆà
    8385            self.end()ˆà
    8486            returnˆà
    òÀæ òÀæ ˆà
    99101        if self.dead_snake_check() == False:ˆà
    100102            returnˆà
    101ˆà        if self.step_id <= 200:ˆà
    ˆà103        if self.step_id <= self.game_length:ˆà
    102104            if self.after_id != None:ˆà
    103105                self.canvas.after_cancel(self.after_id)ˆà
    òÀæ òÀæ ˆà
    141143            self.canvas.after_cancel(self.after_id)ˆà
    142144            passˆà
    143ˆà        self.step_id = 666ˆà
    ˆà145        self.step_id = self.game_length + 666ˆà
    144146        root = tk.Tk()ˆà
    145147        end_label = tk.Label(root, text="End")ˆà
Note: See TracChangeset for help on using the changeset viewer.