예제 #1
0
def drawI(iX, iY):
    pscreen.circle(iX, iY, random.randint(30, 33), black, 0)
    pscreen.circle(iX, iY, iR, Gold, 0)
    pscreen.rectangle(iX - 25, iY - 25, iX + 25, iY + 25, black, 0)
    pscreen.circle(iX, iY, random.randint(15, 25), Gold, 0)
    pscreen.rectangle(iX - 12, iY - 12, iX + 12, iY + 12, pGoldr, 0)
    pscreen.circle(iX, iY, random.randint(8, 12), Gold, 0)
    pscreen.rectangle(iX - 6, iY - 6, iX + 6, iY + 6, black, 0)
    pscreen.circle(iX, iY, random.randint(4, 6), Gold, 0)
    pscreen.rectangle(iX - 3, iY - 3, iX + 3, iY + 3, pGoldr, 0)
    pscreen.circle(iX, iY, random.randint(1, 3), Gold, 0)
    pscreen.rectangle(iX - 1, iY - 1, iX + 1, iY + 1, black, 0)
    pscreen.circle(iX, iY, 1, Gold, 0)
def drawBorderBox():
    #defining boxColor for color of border
    boxColor=(randR,randG,randB)
    #rectangles' that make up border
    pscreen.rectangle(0,0,20,799,boxColor,0)
    pscreen.rectangle(0,0,799,20,boxColor,0)
    pscreen.rectangle(799,0,779,799,boxColor,0)
    pscreen.rectangle(0,579,799,799,boxColor,0)
def drawTreasure(x,y):
    #chest1
    #chest top
    pscreen.rectangle(x-50,y-50,x-40,y-20,brown,0)
    pscreen.triangle(x-50,y-50,x-50,y-20,x-60,y-20,brown,0)
    pscreen.triangle(x-40,y-20,x-40,y-50,x-30,y-20,brown,0)
    #chest body
    pscreen.rectangle(x-60,y-20,x-30,y,brown,0)
    #line between chest lid and chest body
    pscreen.line(x-50,y-20,x-40,y-20,black,0)
    #chest lock
    pscreen.rectangle(x-47,y-23,x-42,y-14,yellow,0)
#loop
while True:
    #values
    randMood = m[random.randint(0, len(m) - 1)]
    x = random.randint(0, 799)  #random x cordinate
    y = random.randint(0, 799)  #random y cordinate
    randR = random.randint(5, 255)  #random Red value
    randG = random.randint(5, 255)  #random Green value
    randB = random.randint(5, 255)  #random Blue value
    c = (randR, randG, randB)  #random colors
    #pressing c prints circles on the screen
    if pscreen.keyIsPressed("c"):
        pscreen.circle(x, y, 20, c)
    #pressing s prints squares on the screen
    if pscreen.keyIsPressed("s"):
        pscreen.rectangle(x, y, x - 20, y - 20, c)
    #pressing f prints faces with moods on the screen
    if pscreen.keyIsPressed("f"):

        #draws the defined face
        drawFace(x, y, randMood)
        #clear screen to a random color
    if pscreen.keyIsPressed("e"):
        pscreen.clearScreen(c)
        #random diamonds
    if pscreen.keyIsPressed("d"):
        pscreen.triangle(x, y, x - 6, y, x - 3, y - 10, c)
        pscreen.triangle(x, y, x - 6, y, x - 3, y + 10, c)
    if pscreen.keyIsPressed("escape"):
        break
    pscreen.updateScreen()
예제 #5
0
def drawBackground():
    pscreen.rectangle(0, 0, 799, 799, randC, 0)
    pscreen.circle(300, 300, 200, (178, 34, 34), 0)
    pscreen.circle(300, 300, 100, (178, 40, 40), 0)
             1)  #changed it from (170,180,210,170)

#pacman
#body
pscreen.circle(400, 200, 25, (255, 255, 0), 0)  #changed it from (400,200,25)
#eye
pscreen.circle(400, 185, 3, (0, 0, 0), 0)  #changed it from (400,175,10)

#mouth
pscreen.triangle(400, 200, 450, 225, 450, 175, (0, 0, 0), 0)

#ghost
#body
pscreen.circle(700, 205, 25, (0, 255, 255), 0)  #changed from (700,175,25)
#deleted (pscreen.rectangle(675,200,725,175,(0,255,255),0))
pscreen.rectangle(675, 225, 725, 200, (0, 255, 255), 0)

#eyes
pscreen.circle(685, 200, 3, (0, 0, 0), 0)  #changed from (685,185,5)
pscreen.circle(715, 200, 3, (0, 0, 0), 0)  #changed from (715,185,5)
#mouth
pscreen.line(685, 210, 715, 210, (0, 0, 0), 1)
#triagle base
pscreen.triangle(675, 225, 675, 230, 680, 225, (0, 255, 255), 0)
pscreen.triangle(680, 225, 680, 230, 685, 225, (0, 255, 255), 0)
pscreen.triangle(685, 225, 685, 230, 690, 225, (0, 255, 255), 0)
pscreen.triangle(690, 225, 690, 230, 695, 225, (0, 255, 255), 0)
pscreen.triangle(695, 225, 695, 230, 700, 225, (0, 255, 255), 0)
pscreen.triangle(700, 225, 700, 230, 705, 225, (0, 255, 255), 0)
pscreen.triangle(705, 225, 705, 230, 710, 225, (0, 255, 255), 0)
pscreen.triangle(710, 225, 710, 230, 715, 225, (0, 255, 255), 0)
예제 #7
0
def drawG():  #draws the ground
    pscreen.rectangle(0, 525, 799, 599, (105, 105, 105), 0)
예제 #8
0
def drawP():  #draws the player
    #main canon body
    pscreen.triangle(pX - 5, pY, pX + 25, pY, pX + 10, pY - 30,
                     (245, 245, 245), 0)
    pscreen.rectangle(pX + 5, pY, pX + 15, pY - 10, (105, 105, 105), 0)
    pscreen.circle(pX + 10, pY - 20, random.randint(1, 4), (255, 215, 0), 0)
    ship_x += resultant_dx
    ship_y += resultant_dy

    #wrap ship on screen
    if ship_x < 0:
        ship_x = 799
    if ship_x > 799:
        ship_x = 0
    if ship_y < 0:
        ship_y = 599
    if ship_y > 599:
        ship_y = 0

    #draw everything
    #pscreen.clearScreen((0,0,0,5))
    pscreen.rectangle(0, 0, 799, 599, (0, 0, 0, 5),
                      0)  #leave motion blur by clearing with alpha

    modulation_angle += 1
    #draw planet
    pscreen.circle(400, 300,
                   100 + 10 * math.sin(math.radians(modulation_angle / 2)),
                   (150 + 50 * math.sin(math.radians(modulation_angle)),
                    150 + 50 * math.sin(math.radians(modulation_angle + 120)),
                    150 + 50 * math.sin(math.radians(modulation_angle + 240))),
                   0)
    #draw target
    pscreen.circle(
        target_x + 100 * math.sin(math.radians(modulation_angle * 2)),
        target_y + 200 * math.sin(math.radians(modulation_angle * 1.5)), 10,
        (255, 255, 255), 0)
예제 #10
0
    y = pscreen.mouseGetY()
    #random color values for F1 button
    rand_x = random.randint(0, 255)
    rand_y = random.randint(0, 255)
    rand_z = random.randint(0, 255)
    #screen refresh
    pscreen.updateScreen()
    #loop break
    if pscreen.keyIsPressed("q"):
        break
    #mouse button brush's
    if pscreen.mouseGetButtonR():
        if isCircle:
            pscreen.circle(x, y, brush_radius, (0, 0, 0), 0)
        else:
            pscreen.rectangle(x, y, x - brush_radius, y - brush_radius,
                              (0, 0, 0), 0)
    if pscreen.mouseGetButtonL():
        if isCircle:
            pscreen.circle(x, y, brush_radius, brush_color, 0)
        else:
            pscreen.rectangle(x, y, x - brush_radius, y - brush_radius,
                              brush_color, 0)
#Clear Screen
    if pscreen.keyIsPressed("c"):
        pscreen.clearScreen((0, 0, 0))

#Boarders where you cant leave program
    if x < 0:
        x = 0
    if x > 799:
        x = 799