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]))
def updateDisplay(state): # print("Updating display with state = ", state) if (state.needsDisplayUpdate == True): dw.erase() dw.draw(state.original, (0, 0)) dw.draw(state.processed, (((state.original).get_size())[0], 0)) dw.flush() state.needsDisplayUpdate = False
def updateDisplay(state): # print("Updating display with state = ", state) if (state['needsDisplayUpdate'] == True): dw.erase() dw.draw(state['original'], (0,0)) dw.draw(state['processed'], (((state['original']).get_size())[0],0)) dw.flush() state['needsDisplayUpdate'] = False
def updateDisplay(state): # print("Updating display with state = ", state) if state["needsDisplayUpdate"] == True: dw.erase() dw.draw(state["original"], (0, 0)) dw.draw(state["processed"], (((state["original"]).get_size())[0], 0)) dw.flush() state["needsDisplayUpdate"] = False
def updateDisplay(state): # print("Updating display with state = ", state) if (state.needsDisplayUpdate == True): dw.erase() dw.draw(state.original, (0,0)) dw.draw(state.processed, (((state.original).get_size())[0],0)) dw.flush() state.needsDisplayUpdate = False
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))
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))
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
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
def disp(self, screen): if self.health >= 80: image = target1 elif self.health >= 60: image = target2 elif self.health >= 40: image = target3 elif self.health >= 20: image = target4 elif self.health >= 0: image = target5 else: self.alive = False if self.alive is True: # pg.draw.circle(screen, BLUE, [self.Xcoord, self.Ycoord], 30) dw.draw(image, (self.Xcoord - 20, self.Ycoord - 20))
def disp(self, screen): # the turret displays a different image the less health it # has, to indicate to the player how damaged it is if self.health >= 80: image = target1 elif self.health >= 60: image = target2 elif self.health >= 40: image = target3 elif self.health >= 20: image = target4 elif self.health >= 0: image = target5 else: self.alive = False # the image only displays if the turret is alive if self.alive is True: # pg.draw.circle(screen, BLUE, [self.Xcoord, self.Ycoord], 30) dw.draw(image, (self.Xcoord - 20, self.Ycoord - 20))
def updateDisplay(state): dw.fill(dw.black) dw.draw(myimage, (state, width/2))
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))
def updateDisplay(state): dw.fill(dw.black) dw.draw(myimage, (state[0], state[2])) ### state = <x, dx, y, dy>
def updateDisplay(state): dw.fill(dw.black) dw.draw(myimage, (state[0], height/2))
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))
def updateDisplay(state): dw.fill(dw.white) dw.draw(myimage1, (car1.xpos,car1.ypos)) dw.draw(myimage2, (car2.xpos,car2.ypos))
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))
def updateDisplay(state): dw.fill(dw.white) dw.draw(myimage, (state.xpos, state.yvel)) dw.draw(otherimage, (width / 2, height - 100))
def updateDisplay(state): dw.fill(dw.blue) dw.draw(otherlabel, (150,100)) dw.draw(myimage, (state[0], width/50)) dw.draw(mylabel, (250,250))
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])
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
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))
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]))
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))
def updateDisplay(state): dw.fill(dw.white) dw.draw(myimage, (state[0], state[2]))
def updateDisplay(self): dw.fill(dw.blue) dw.draw(myimage, (self.BallXpos, self.BallYpos)) dw.draw(secondimage, (750, self.HoopYpos))
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))
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_))
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))
def updateDisplay(state): dw.fill(dw.black) dw.draw(myimage, (state[0], state[1]))
def updateDisplay(state): dw.fill(dw.black) dw.draw(myimage, (state, width / 2))