demonstrates pause function
from game_library import * from functions import * from math import * from kandinsky import * from ion import * from random import * pause=True new_rect=False c=randint(300,350) d=randint(15,80) w=randint(5,25) h=randint(2,7) rect_color=choice(["black","gray","brown"]) timer=0 bg="white" #(randint(0,255),randint(0,255),randint(0,255)) fill_rect(0,0,322,222,bg) while 1: d+=randint(-2,2) c-=1 fill_rect(c,d,w,h,rect_color) fill_rect(c+w,d,w,h,bg) timer+=1 if timer>randint(600,1000): new_rect=choice([True,False]) timer=0 if c < - w-1 : c=randint(300,650) d=randint(15,80) if new_rect: w=randint(3,20) h=randint(2,8) rect_color=choice(["black","gray","brown"]) new_rect=0 if keydown(KEY_BACKSPACE) or pause: draw_string("(PAUSED)",110,150,"black",bg) draw_string("Key [Backspace] = Pause/Resume",10,180,"black",bg) while keydown(KEY_BACKSPACE): pass pause=1 while not keydown(KEY_BACKSPACE): pass pause=0 while keydown(KEY_BACKSPACE): draw_string(" ",110,150,bg,bg) draw_string(" ",10,180,bg,bg) pass pause=0