Ejemplo n.º 1
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))
Ejemplo n.º 2
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))
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
Ejemplo n.º 4
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.º 5
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))
Ejemplo n.º 6
0
import runWorld as rw
import drawWorld as dw
import pygame as pg

name = "UVA"
width = 1000
height = 1000
rw.newDisplay(width, height, name)

initState = (0,1)

myimage = dw.loadImage("uva.png")

mylabel = dw.makeLabel("Go Hoos!", "arial", 100, (0,0,255))
otherlabel = dw.makeLabel("Don't lose the Hoos", "serif", 80, (255,255,255))

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 updateState(state):
    return((state[0]+state[1]),state[1])


def endState(state):
    if (state[0] >= width or state[0] < -width):
        return True
    else:
Ejemplo n.º 7
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.º 8
0
fig = 20
tiffany = (66,199,249)
rw.newDisplay(width, height, name)

################################################################

# Display the state by drawing a cat at that x coordinate
myimage = dw.loadImage("cat.bmp")
myfish= dw.loadImage("Fish.bmp")
myacpnt = dw.loadImage("circle.bmp")
inst_line1 = "When the cat catches the fish, you win!"
inst_line2 = "Every time the cat reaches one of the points, it would accelerate."
inst_line3 = "When the cat reaches the lower and upper bounds, it will bounce back."
inst_line4 = "When the cat touches the left and right sides, it will die and the game is over."
inst_line5 = "Click the mouse and get start. Enjoy!"
mylabel0 = dw.makeLabel("Instructions:","serif",24,dw.black)
mylabel1 = dw.makeLabel(inst_line1,"serif",12,dw.black)
mylabel2 = dw.makeLabel(inst_line2,"serif",12,dw.black)
mylabel3 = dw.makeLabel(inst_line3,"serif",12,dw.black)
mylabel4 = dw.makeLabel(inst_line4,"serif",12,dw.black)
mylabel5 = dw.makeLabel(inst_line5,"serif",12,dw.black)
firstdisp = True


# state -> image (IO)
# draw the cat halfway up the screen (height/2) and at the x
# coordinate given by the first component of the state tuple
#
def updateDisplay(state):
    global firstdisp
    dw.fill(tiffany)
Ejemplo n.º 9
0
import runWorld as rw
import drawWorld as dw
import pygame as pg

name = "UVA"
width = 1000
height = 1000
rw.newDisplay(width, height, name)

initState = (0,1)

myimage = dw.loadImage("uva.png")


mylabel = dw.makeLabel("Go Hoos!", "arial", 100, (0,0,255))

def updateDisplay(state):
    dw.fill(dw.blue)
    dw.draw(myimage, (state[0], width/50))
    dw.draw(mylabel, (250,250))

    
def updateState(state):
    return((state[0]+state[1]),state[1])


def endState(state):
    if (state[0] >= width or state[0] < 0):
        return True
    else:
        return False
Ejemplo n.º 10
0
def updateDisplay(state):
    dw.fill(dw.blue)
    dw.draw(myimage, (state.x, state.y))
    dw.draw(myimage2, (state.x, state.y-50))
    dw.draw(dw.makeLabel("SPEED: "+ str(counter), "Helvetica", 50, dw.black), (12, 12))
    dw.draw(dw.makeLabel("Try to reach max speed!", "Helvetica", 50, dw.black), (50, 50))