コード例 #1
0
 def display(self):
     dw.fill(dw.black)
     self.player.disp(self.screen)
     for ent in self.turrets:
         ent.disp(self.screen)
     for shot in self.shots:
         shot.disp()
コード例 #2
0
def updateDisplay(state):
    d = 0
    dw.fill(dw.black)
    while d < numofs - 1:
        dw.draw(dot, (s[d][0], s[d][1]))
        d += 1
    dw.draw(state.image, (s[state.position][0], s[state.position][1]))
コード例 #3
0
def updateDisplay(state):
    dw.fill(dw.black)
    if (state[4] == 1):  # if state sub 4 is 1, draw left arm up
        dw.draw(leftHigh, (state[0] + 200, state[1] - 100))
    else:  # else draw left arm down
        dw.draw(leftLow, (state[0] + 200, state[1] + 225))
    if (state[5] == 1):  # if state sub 5 is 1, draw right arm up
        dw.draw(rightHigh, (state[2] - 150, state[3] - 100))
    else:  # else draw right arm down
        dw.draw(rightLow, (state[2] - 150, state[3] + 225))

    if (state[6] >= 0):  # If slapCharge is positive, no slaps
        slapNumberLeft = "0"
    else:  # if negative, one slap per 60 frames of charge / one second
        slapNumberLeft = str(-state[6]//60)

    if (state[7] >= 0):  # If slapCharge is positive, no slaps
        slapNumberRight = "0"
    else:  # if negative, one slap per 60 frames of charge / one second
        slapNumberRight = str(-state[7]//60)

    slapCounterLeft = dw.makeLabel(slapNumberLeft,
                                   "Times New Roman, Ariel", 72, dw.white)
    slapCounterRight = dw.makeLabel(slapNumberRight,
                                    "Times New Roman, Ariel", 72, dw.white)

    dw.draw(rightTorso, (state[2], state[3]))
    dw.draw(leftTorso, (state[0], state[1]))
    dw.draw(slapCounterLeft, (50, 650))
    dw.draw(slapCounterRight, (1100, 650))
コード例 #4
0
def updateDisplay(state):
    dw.fill(dw.black)
    if state.player1arm == 1:
        dw.draw(leftHigh, (state.player1x + 200, state.player1y - 100))
    else:
        dw.draw(leftLow, (state.player1x + 200, state.player1y + 225))
    if state.player2arm == 1:
        dw.draw(rightHigh, (state.player2x - 150, state.player2y - 100))
    else:
        dw.draw(rightLow, (state.player2x - 150, state.player2y + 225))

    if state.player1slaps >= 0:
        slapNumberLeft = "0"
    else:
        slapNumberLeft = str(-state.player1slaps // 30)

    if state.player2slaps >= 0:
        slapNumberRight = "0"
    else:
        slapNumberRight = str(-state.player2slaps // 30)

    slapCounterLeft = dw.makeLabel(slapNumberLeft, "Times New Roman, Ariel", 72, dw.white)
    slapCounterRight = dw.makeLabel(slapNumberRight, "Times New Roman, Ariel", 72, dw.white)

    dw.draw(rightTorso, (state.player2x, state.player2y))
    dw.draw(leftTorso, (state.player1x, state.player1y))
    dw.draw(slapCounterLeft, (50, 650))
    dw.draw(slapCounterRight, (1100, 650))
コード例 #5
0
 def display(self):
     # first the screen is wiped clean, then the player is
     # displayed, and the two loops display all of the turrets and
     # all of the active projectiles
     dw.fill(dw.black)
     self.player.disp(self.screen)
     for ent in self.turrets:
         ent.disp(self.screen)
     for shot in self.shots:
         shot.disp()
コード例 #6
0
 def display(self):
     # first the screen is wiped clean, then the player is
     # displayed, and the two loops display all of the turrets and
     # all of the active projectiles
     dw.fill(dw.black)
     self.player.disp(self.screen)
     for ent in self.turrets:
         ent.disp(self.screen)
     for shot in self.shots:
         shot.disp()
コード例 #7
0
ファイル: ColorGame.py プロジェクト: TaKo2019/AKT-Project
def updateDisplay(state):
    dw.fill((state[4],state[5],state[6]))
    #dw.draw(bgrnd, (0,0))
    #dw.draw(myimage, (state[0], state[2]))
    pg.draw.rect(squareSurf,(abs(state[4]-state[7]),abs(state[5]-state[7]),abs(state[6]-state[7])),square)
    dw.draw(squareSurf,(state[0],state[2]))
    scorestring = str(state[8])
    if state[8] == 31:
        scorestring = "Win"
    label2 = myfont.render(scorestring,1,(0,0,0))
    dw.draw(label2, (0,0))
コード例 #8
0
ファイル: ColorGame-oo.py プロジェクト: TaKo2019/AKT-Project
def updateDisplay(state):
    dw.fill((State.BG_r,State.BG_g,State.BG_b))
    #dw.draw(bgrnd, (0,0))
    #dw.draw(myimage, (State.Xpos, State.Ypos))
    pg.draw.rect(squareSurf,(abs(State.BG_r-State.ColorDiff),abs(State.BG_g-State.ColorDiff),abs(State.BG_b-State.ColorDiff)),square)
    dw.draw(squareSurf,(State.Xpos,State.Ypos))
    scorestring = str(State.Score)
    if State.Score == 31:
        scorestring = "Win"
    label2 = myfont.render(scorestring,1,(0,0,0))
    dw.draw(label2, (0,0))
コード例 #9
0
def updateDisplay(state):
    dw.fill(dw.black)
    dw.draw(myimage, (state.cat["xcord"], state.cat["ycord"]))
    dw.draw(mymouse, (state.mouse["xcord"], state.mouse["ycord"]))
    dw.draw(mycheese, (state.cheese['xcord'],state.cheese["ycord"]))
    if ((state.cat["xcord"]-75) < state.mouse["xcord"]  and state.mouse["xcord"] < (state.cat["xcord"]+105) and (state.cat["ycord"]-75) <state.mouse["ycord"] and state.mouse["ycord"] < (state.cat["ycord"]+105)):
        dw.fill(dw.red)
        dw.draw(myimage, (state.cat["xcord"], state.cat["ycord"]))
        dw.draw(mymouse, (state.mouse["xcord"], state.mouse["ycord"]))
        dw.draw(mycheese, (state.cheese["xcord"],state.cheese["ycord"]))
        dw.draw(dangerText, (state.mouse["xcord"] - 70 , state.mouse["ycord"] + 70))
コード例 #10
0
ファイル: catGo.py プロジェクト: proh03/simulationproject
def updateDisplay(state):
    dw.fill(dw.sage)
    dw.draw (catfood, [920,0])
    dw.draw(myimage, (state.x, state.y))
    dw.draw(dogimage, [200, 400])
    dw.draw(cactusimage, [580, 120])
    dw.draw(pondimage, [600, 500])
    dw.draw(waterimage, [120, 0])
    dw.draw(beeimage, [850, 300])
    dw.draw(faucetimage, [300, 450])
    if (state.x>=900 and state.y>=0):
        dw.draw(winimage, [250, 10])
コード例 #11
0
ファイル: planets.py プロジェクト: runningchick/simulation
def endState(state):
    if ((state[0] <= state[2] <= (state[0]+70)) and (state[1] <= state[3] <= (state[1]+70)) ):
        dw.draw(impact,[0,0])
        pg.display.update()
        time.sleep(2)
        font = pg.font.SysFont (None, 50)
        end_text = font.render("By: Cody, Emma, Corey", True, dw.green)
        dw.fill(dw.black)
        dw.draw(end_text, [100, height/2])
        pg.display.update()
        time.sleep(2)
        return True
    else:
        return False
コード例 #12
0
ファイル: planets-oo.py プロジェクト: runningchick/simulation
def endState(state):
    if (state.earth_x <= state.comet_x <= (state.earth_x + 70)) and (
        state.earth_y <= state.comet_y <= (state.earth_y + 70)
    ):
        dw.draw(state._impact, [0, 0])
        pg.display.update()
        time.sleep(2)
        font = pg.font.SysFont(None, 50)
        end_text = font.render("By: Cody, Emma, Corey", True, dw.green)
        dw.fill(dw.black)
        dw.draw(end_text, [100, height / 2])
        pg.display.update()
        time.sleep(2)
        return True
    else:
        return False
コード例 #13
0
ファイル: catFun.py プロジェクト: WhispersX/Project
def updateDisplay(state):
    global firstdisp
    dw.fill(tiffany)
    if(firstdisp):
        dw.draw(mylabel0,(50,70))
        dw.draw(mylabel1,(50,100))
        dw.draw(mylabel2,(50,120))
        dw.draw(mylabel3,(50,140))
        dw.draw(mylabel4,(50,160))
        dw.draw(mylabel5,(50,180))
    #display fish, cat, and points after the first click
    else:
        dw.draw(myimage, (state[0],state[2])) #x,y coordinate
        dw.draw(myacpnt, (acpntsState[0],acpntsState[2])) #x,y coordinate
        dw.draw(myacpnt, (acpntsState[0],acpntsState[3])) #x,y coordinate
        dw.draw(myacpnt, (acpntsState[1],acpntsState[2])) #x,y coordinate
        dw.draw(myacpnt, (acpntsState[1],acpntsState[3])) #x,y coordinate
        dw.draw(myfish, fishState) #x,y coordinate
コード例 #14
0
def updateDisplay(state):
    #what you see on the screen at first
    dw.fill(dw.black)
    dw.draw(myimage, (500, 550-state.pos))
    # the tachometer will reach the top of the screen when RPM = 1
    dw.draw(tach, (50, 600 - 600*(state.rpm)))
    #indicators
    # if rpmrealistic = true, rpm will display as a function from rpmmin
    # to rpmmax. 
    if rpmrealistic == True:
        rpm = 'RPM:' + str(round((rpmmax-rpmmin)*state.rpm+rpmmin, 0))
    else: rpm = 'RPM' + str (round (state.rpm, 2))
    time = ((pg.time.get_ticks()) / 1000)
    timelabel = 'Time:' + str(time)
    # if speedrealistic = true, speed will look like mph
    if speedrealistic == True:
        speed = 'speed:' + str(round((50*state.velo), 0))
    else:
        speed = 'speed:' + str(round ((state.velo), 2))
    instructions = 'W to go. R to shift. try not to stall!'
    #labels
    label1 = dw.makeLabel(rpm, 'impact', 40, (255, 255, 255))
    label2 = dw.makeLabel(timelabel, 'impact', 40, (255, 255, 255))
    label3 = dw.makeLabel(speed, 'impact', 40, (255, 255, 255))
    label4 = dw.makeLabel(instructions, 'impact', 20, (255, 255, 255))
    #label locations
    dw.draw(label1, (250, 420))
    dw.draw(label2, (250, 320))
    dw.draw(label3, (250, 220))
    dw.draw(label4, (250, 550))
    #these are the gear indicators
    if (state.gear == 1):
        dw.draw(gear1, (150, 500))
    if (state.gear == 2):
        dw.draw(gear2, (150, 450))
    if (state.gear == 3):
        dw.draw(gear3, (150, 400))
    if (state.gear == 4):
        dw.draw(gear4, (150, 350))
    if (state.gear == 5):
        dw.draw(gear5, (150, 300))
    else:
        return None
コード例 #15
0
ファイル: drolivery.py プロジェクト: HongfanLiu/Drolivery
def updateDisplay(state):
    dw.fill(dw.white)
    global scoreText
    global name

    if (gameState == 0):
        dw.draw(droneImage, (state[0], state[2]))
        dw.draw(deliveryImage, (deliveryInitState[0], deliveryInitState[1]))
        scoreText = font.render("Score: " + str(score), 1, (0, 0, 0))
        dw.draw(scoreText, (WIDTH / 2, 5))
    else:
        name = "Score"
        if (gameState == 1):
            winLose = font.render("You LOST!",1,(0,0,0))
            scorePrint = font.render("Your score was: " + str(score),1,(0,0,0))
        else:
            winLose = font.render("You WON!",1,(0,0,0))
            scorePrint = font.render("Your score was: " + str(10000 - score),1,(0,0,0))

        restart = font.render("Press [Space Bar] to restart...",1,(0,0,0))

        dw.draw(scorePrint, ((WIDTH / 2) - 100, HEIGHT/2))
        dw.draw(winLose, ((WIDTH / 2) - 50, (HEIGHT / 2) - 80))
        dw.draw(restart, ((WIDTH / 2) - 150, (HEIGHT / 2) + 80))
コード例 #16
0
def updateDisplay(state):
    if state.Lives == (2):
        label = dw.makeLabel("Lives = " + str(state.Lives), 'serif', 20, (255, 255, 255))
        dw.fill(dw.blue)
        dw.draw(sleepydonald, (250, 250))
        dw.draw(cat, (state.x, state.y))
        dw.draw(label, (850, 50))
    elif state.Lives == (1):
        label = dw.makeLabel("Lives = " + str(state.Lives), 'serif', 20, (255, 255, 255))
        dw.fill(dw.red)
        dw.draw(angrydonald, (250, 250))
        dw.draw(cat, (state.x, state.y))
        dw.draw(label, (850, 50))
    else:
        dw.fill(dw.black)
        dw.draw(donald, (100, 100))
        dw.draw(gameover, (350, 350))
    return state
コード例 #17
0
def updateDisplay(state):
    dw.fill(dw.black)
    dw.draw(myimage, (state, width / 2))
コード例 #18
0
ファイル: catGo.py プロジェクト: eak2xt/cs1
def updateDisplay(state):
    dw.fill(dw.black)
    dw.draw(myimage, (state[0], height/2))
コード例 #19
0
ファイル: sleep.py プロジェクト: Stdjohnson/Lab
def updateDisplay(state):
    dw.fill(dw.black)
    dw.draw(myimage, (state, width/2))
コード例 #20
0
def updateDisplay(state):
    dw.fill(dw.white)
    dw.draw(goal, (0, 0, 0, 0))
    dw.draw(myimage, (state.xpos, state.ypos, state.xvel, state.yvel))
コード例 #21
0
def updateDisplay(state):
    dw.fill(dw.black)
    dw.draw(myimage, (state[0], state[2])) ### state = <x, dx, y, dy>
コード例 #22
0
def updateDisplay(state):
	dw.fill((100, 0, 70))
	dw.draw(state.img, (state.xpos, state.ypos))
	dw.draw(dw.makeLabel("Click to Survive! Score: " + str(counter), "Vendera", 25, dw.red), (12, 12))
コード例 #23
0
def updateDisplay(state):
    dw.fill(dw.white)
    dw.draw(myimage, (state[0], state[2]))
コード例 #24
0
ファイル: catGo.py プロジェクト: BravoEch/ImageProcessing
def updateDisplay(state):
    dw.fill(dw.black)
    dw.draw(myimage, (state[0], height/2))
コード例 #25
0
ファイル: planets.py プロジェクト: runningchick/simulation
def updateDisplay(state):
    dw.fill(dw.black)
    dw.draw(sun, (200, 200))
    dw.draw(earth, (state[0], state[1]))
    dw.draw(comet, (state[2], state[3]))
コード例 #26
0
def updateDisplay(state):
    dw.fill(dw.white)
    dw.draw(myimage, (state.xpos, state.yvel))
    dw.draw(otherimage, (width / 2, height - 100))
コード例 #27
0
ファイル: carrace.py プロジェクト: hbh3re/miniproject
def updateDisplay(state):
    dw.fill(dw.white)
    dw.draw(myimage1, (car1.xpos,car1.ypos))
    dw.draw(myimage2, (car2.xpos,car2.ypos))
コード例 #28
0
def updateDisplay(state):
    dw.fill(dw.green)
    dw.draw(myimage, (state.x, state.y))
    dw.draw(goal, (870,550))
    dw.draw(player,(0,500))
    dw.draw(player2, (550,10))
コード例 #29
0
ファイル: catFun.py プロジェクト: fwtan/cs1113-15fall
def updateDisplay(state):
    dw.fill(dw.blue);
    dw.draw(state.img_w1_.img_, (state.img_w1_.px_, state.img_w1_.py_))
    dw.draw(state.img_w2_.img_, (state.img_w2_.px_, state.img_w2_.py_))
コード例 #30
0
def updateDisplay(state):
    if (gameState == 0):
        dw.fill((100, 0, 70))
        dw.draw(myimage, (state[0], state[2]))
        dw.draw(dw.makeLabel("Click to Survive! Score: " + str(counter), "Vendera", 25, dw.red), (12, 12))
コード例 #31
0
def updateDisplay(state):
    dw.fill(dw.white)
    drawCircle((0, 0, 255), (250, 250), 250, 150)
コード例 #32
0
ファイル: catFun.py プロジェクト: runningchick/simulation
def updateDisplay(state):
    dw.fill(dw.black)
    dw.draw(myimage, (state[0], state[1]))
コード例 #33
0
ファイル: uvaGameFinal.py プロジェクト: ckz5ac/miniproject
def updateDisplay(state):
    dw.fill(dw.blue)
    dw.draw(otherlabel, (150,100))
    dw.draw(myimage, (state[0], width/50))
    dw.draw(mylabel, (250,250))