Lecture Date: Friday, November 4

We start the game project today (well, yesterday in lab) and we'll look at some of the neat things you can do with PyGame and gamebox! We will also go over the parameters of POTD 16 and the final project.

We will build some pieces of a very simple game!

# jumping puzzle game - pt1 - draw the score and timer on the screen

import pygame
import gamebox
camera = gamebox.Camera(800,600)

time = 9000
score = 0

def tick(keys):
    global time, score

    # clear display

    # decrease timer per call of tick
    time -= 1

    # calculate timer
    seconds = str(int((time/ticks_per_second))).zfill(3)

    # write timer and score to screen
    time_box = gamebox.from_text(650,30,"Time Remaining: " + seconds,"arial",24,"white")
    score_box = gamebox.from_text(75,30,"Score: " + str(score),"arial",24,"white")

ticks_per_second = 30

# keep this line the last one in your program
gamebox.timer_loop(ticks_per_second, tick)