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]))
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
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
Ejemplo n.º 6
0
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
Ejemplo n.º 7
0
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))
Ejemplo n.º 8
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))
Ejemplo n.º 9
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
Ejemplo n.º 10
0
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
Ejemplo n.º 11
0
    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))
Ejemplo n.º 12
0
    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))
Ejemplo n.º 13
0
    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))
Ejemplo n.º 14
0
def updateDisplay(state):
    dw.fill(dw.black)
    dw.draw(myimage, (state, width/2))
Ejemplo n.º 15
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))
def updateDisplay(state):
    dw.fill(dw.black)
    dw.draw(myimage, (state[0], state[2])) ### state = <x, dx, y, dy>
Ejemplo n.º 17
0
def updateDisplay(state):
    dw.fill(dw.black)
    dw.draw(myimage, (state[0], height/2))
Ejemplo n.º 18
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))
Ejemplo n.º 19
0
Archivo: catGo.py Proyecto: eak2xt/cs1
def updateDisplay(state):
    dw.fill(dw.black)
    dw.draw(myimage, (state[0], height/2))
Ejemplo n.º 20
0
def updateDisplay(state):
    dw.fill(dw.white)
    dw.draw(myimage1, (car1.xpos,car1.ypos))
    dw.draw(myimage2, (car2.xpos,car2.ypos))
Ejemplo n.º 21
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))
def updateDisplay(state):
    dw.fill(dw.white)
    dw.draw(myimage, (state.xpos, state.yvel))
    dw.draw(otherimage, (width / 2, height - 100))
Ejemplo n.º 23
0
def updateDisplay(state):
    dw.fill(dw.blue)
    dw.draw(otherlabel, (150,100))
    dw.draw(myimage, (state[0], width/50))
    dw.draw(mylabel, (250,250))
Ejemplo n.º 24
0
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])
Ejemplo n.º 25
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
Ejemplo n.º 26
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))
Ejemplo n.º 27
0
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]))
Ejemplo n.º 28
0
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))
Ejemplo n.º 29
0
def updateDisplay(state):
    dw.fill(dw.white)
    dw.draw(myimage, (state[0], state[2]))
Ejemplo n.º 30
0
 def updateDisplay(self):
     dw.fill(dw.blue)
     dw.draw(myimage, (self.BallXpos, self.BallYpos))
     dw.draw(secondimage, (750, self.HoopYpos))
Ejemplo n.º 31
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))
Ejemplo n.º 32
0
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_))
Ejemplo n.º 33
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))
Ejemplo n.º 34
0
def updateDisplay(state):
    dw.fill(dw.black)
    dw.draw(myimage, (state[0], state[1]))
Ejemplo n.º 35
0
def updateDisplay(state):
    dw.fill(dw.black)
    dw.draw(myimage, (state, width / 2))