def __init__(self): self.time = 0 self.t = canvas.create_timer(25, self.render) self.new_game() self.fond = Media("fond", DIR + "basket-hoop.png", (200, 135), (400, 370), (150, 150)) info = Media("ball", DIR + "basketball.png", (128, 128), (256, 256), (70, 70)) self.ball = Ball([55, 350.5], [0, 0.981], info, 0, 1)
def __init__(self): self.time = 0 self.t = canvas.create_timer(25, self.render) self.t2 = canvas.create_timer(1000, self.timer) self.new_game() self.fond = Media("fond",DIR+"nebula_blue.s2014.png",0,(400,300),(800,600),(500,500)) self.debris = Media("debris",DIR+"debris2_blue.png",0,(320, 240), (640, 480),(500,500)) info = Media("ship",DIR+"double_ship.png",45,(45,45),(90,90),(75,75)) self.ship = Ship([235.5,235,5],[1,0], info) info = Media("missile",DIR+"shot2.png",5,(5,5),(10,10)) self.a_missile = Sprite([0,0],[0,0],info) info = Media("asteroid",DIR+"asteroid_blue.png",30,(45,45),(90,90),(60,60)) self.a_rock = Sprite([0,HEIGHT/2],[1,1],info,1,1) info = Media("explosion",DIR+"explosion_alpha.png",64,(64, 64), (128, 128),(128, 128)) self.a_rock_exploded = Sprite([0,0],[0,0],info)
#dessin des fils canvas.draw_line((0,290+top),(100,290+top),3,'Blue') canvas.draw_line((150,290+top),(200,290+top),3,'Blue') canvas.draw_line((200,230+top),(200,350+top),3,'Blue') canvas.draw_line((200,230+top),(250,230+top),3,'Blue') canvas.draw_line((200,350+top),(250,350+top),3,'Blue') canvas.draw_line((300,230+top),(350,230+top),3,'Red') canvas.draw_line((300,350+top),(350,350+top),3,'Red') canvas.draw_line((350,230+top),(350,350+top),3,'Red') canvas.draw_line((500,290+top),(350,290+top),3,'Red') canvas.draw_circle((420, 290+top), 30, 2, 'Blue', color(out)) canvas.draw_text("A",(115,270+top),24,cl2) canvas.draw_text("B",(267,210+top),24,cl2) canvas.draw_text("C",(267,330+top),24,cl2) #dessin des interrupteurs if bits['C'] == 0: canvas.draw_line((250,350+top),(300,350+top),3,'Orange') else: canvas.draw_line((250,350+top),(300,330+top),3,'Orange') #appel de la temporisation de dessin de l'ecran t = canvas.create_timer(17,draw) t.start()
def __init__(self): self.t = canvas.create_timer(200, self.render) self.new_game()
i += 1 if c<> ".": x = ML+i*(W-2*ML)/8 - 25 y = MT+j*(W-2*MT)/8 + 12 p = pieces[c] canvas.draw_image(pions, ( pions_center[0]+p[1]*pions_size[0], pions_center[1]+p[0]*pions_size[1]), pions_size, (x,y), pions_size2, 0 ) j += 1 if count < len(partie): canvas.draw_text(partie[count],(20,20),24,'Blue') jeu.move(partie[count]) jeu.advance() count += 1 canvas.clear_timers() count = 0 timer = canvas.create_timer(2000, render) timer.start()
c = get_kb() if c == '37': #canvas.draw_text(250,250,"<-") lining = False if c == '39': #canvas.draw_text(250,250,"<-") lining = True ms = get_mouse() if len(ms) > 0: if not (ms in points): points.append(ms) count += 1 for p in points: canvas.draw_circle(p[0],p[1],2) if lining: for i in range(len(points)-1): canvas.draw_line(points[i+1][0],points[i+1][1], points[i][0],points[i][1]) #debug(points) #if count == 100: #timer.stop() timer = canvas.create_timer(10, render) timer.start()
#cards import canvas import games import document play = document.getElementById('chk').checked if play == 'True': music = canvas.load_sound("http://mrt2.no-ip.org/skulpt/assets/Epoq-Lepidoptera.ogg") music.play() canvas.clear() image = canvas.load_image("http://mrt2.no-ip.org/skulpt/assets/cards.jfitz.png") card_size = (73, 98) card_center = (0, 0) desk = games.Deck() def tick(): global desk, image, card_size, card_center for i in range(6): carte = desk.give_card() canvas.draw_image(image, (card_size[0]*carte[0],card_size[1]*carte[1]), card_size, (74*i,0), card_size ) timer = canvas.create_timer(1000, tick) timer.start()