def draw(canvas): canvas.draw_polygon([(0, 400), (0, 100), (500, 100), (500, 400)], 5, "Grey", "Grey") global selected global pointer redsprite.updateStatic(canvas) greensprite.updateStatic(canvas) bluesprite.updateStatic(canvas) yellowsprite.updateStatic(canvas) interaction() if (Mouse.levelSel): pointer = Ai.level - 1 Mouse.levelSel = False selected = True if selected and pointer == 0: Ai.level = pointer + 1 #more efficient than assigning everytime loop is run, although more code Master.gameLoop('Base', 'Red', True) if selected and pointer == 1: Ai.level = pointer + 1 Master.gameLoop('Base', 'Green', True) if selected and pointer == 2: Ai.level = pointer + 1 Master.gameLoop('Base', 'Yellow', True) if selected and pointer == 3: Ai.level = pointer + 1 Master.gameLoop('Base', 'Blue', True) canvas.draw_polygon( [[50 + (pointer * 100), 315], [50 + (pointer * 100), 150], [150 + (pointer * 100), 150], [150 + (pointer * 100), 315]], 5, "Red") canvas.draw_text("Level 1", (75, 300), 20, "White") canvas.draw_text("Level 2", (175, 300), 20, "White") canvas.draw_text("Level 3", (275, 300), 20, "White") canvas.draw_text("Level 4", (375, 300), 20, "White")
def drawSpriteSheet(canvas): canvas.draw_polygon([[125, 105], [125, 420], [375, 420], [375, 105]], 1, 'Grey', 'Grey') canvas.draw_text("Select Sprite", (200, 50), 20, "White") player1.update() player2.update() selection.draw(canvas) if Mouse.spriteSel1: cursor1.selected = True if not Mouse.spriteSel2: cursor1.position = Mouse.spriteSelection if Mouse.spriteSel2: Mouse.spriteSel1 = False cursor2.selected = True cursor2.position = Mouse.spriteSelection Mouse.spriteSel2 = False if cursor1.getSelected(): selectedSprite1.changeState("on") selectedSprite1.nextSprite() else: selectedSprite1.changeState("off") selectedSprite1.nextSprite() if cursor2.getSelected(): selectedSprite2.changeState("on") selectedSprite2.nextSprite() else: selectedSprite2.changeState("off") selectedSprite2.nextSprite() cursor1.draw(canvas) cursor2.draw(canvas) Sprite(previewSprites[cursor1.previewSelection()], 2, 14, (50, 250), 8, "idle", "right").updateStatic(canvas) Sprite(previewSprites[cursor2.previewSelection()], 2, 14, (450, 250), 8, "idle", "left").updateStatic(canvas) selectedSprite1.draw(canvas) selectedSprite2.draw(canvas) if ready(): Master.gameLoop(finalnames[cursor1.previewSelection()], finalnames[cursor2.previewSelection()], False)