Пример #1
0
def endscreen():
    global player,game,keys
    done=False
    while not done:
        mlcd.draw(["score="+str(player["score"])+"spd="+str(game["speed"]),"  -PrashantMohta"])
        keypress()
        if keys["quit"]:
            done=True
    pygame.quit()
    exit()
Пример #2
0
def startscreen():
    global player,game,keys,startstate
    done=False
    while not done:
        if(startstate<len(STARTSCREEN_TEXT)):
            mlcd.draw(STARTSCREEN_TEXT[startstate])
        else:
            done=True
        keypress()
        if keys["space"]:
            startstate+=1
        if keys["quit"]:
            startstate=len(STARTSCREEN_TEXT)+1
Пример #3
0
            keys["space"] = True
        elif event.type == pygame.KEYUP and event.key == pygame.K_ESCAPE:
            keys["quit"] = True


done=False
#initialize mlcd as 16x2 character lcd
mlcd.init(16,2)
while not done:

    #add player to the buffer
    screenbuff[player["line"]][player["position"]]=PLAYER_CHAR
    #ready the lines for drawing on lcd
    lines=[''.join(screenbuff[0]) + "|scr",
         ''.join(screenbuff[1]) + "|"+str(player["score"])]
    mlcd.draw(lines)
    
    #remove player from buffer
    screenbuff[player["line"]][player["position"]]=" "
    #get keypresses
    keypress()
    #modify player line (move the player) if space is pressed
    if keys["space"]:
        if player["line"]==0:
            player["line"]=1
        else:
            player["line"]=0
    #quit
    if keys["quit"]:
        print("game quit")
        done=True
Пример #4
0
import mlcd     #import the module
mlcd.init(16,3) # initialize a 16x3 display
#draw the three lines passed as a list
mlcd.draw(["Hello",         
           "     world",
           "Mock LCD !!!"])

Пример #5
0
import mlcd  #import the module
mlcd.init(16, 3)  # initialize a 16x3 display
#draw the three lines passed as a list
mlcd.draw(["Hello", "     world", "Mock LCD !!!"])