def startGame(): '''starts a new round''' #global maincam #global p1 #global mode #global score #global scoredrop #global scoredropper #global enemies #global stars #global projectiles #global items #global particles #global enemyspawndelay #global cowspawndelay GlobalVariables.enemies = list() GlobalVariables.stars = list() GlobalVariables.projectiles = list() GlobalVariables.items = list() GlobalVariables.particles = list() gotoMode(1) GlobalVariables.score = 0 GlobalVariables.scoredrop = 500 GlobalVariables.enemyspawndelay = 0 GlobalVariables.cowspawndelay = 0 GlobalVariables.scoredropper = None GlobalVariables.maincam = camera() GlobalVariables.p1 = player() # testpow = item((0, 40), 2) # items.append(testpow) # testbas = basher((100,100)) # enemies.append(testbas) # testmtc = motherCow((100,100)) # enemies.append(testmtc) # fills in the stars for i in range(200): GlobalVariables.stars.append(randPoint(500))
main_sd.off() time.sleep(10) display.lcd_clear() time.sleep(3) display.lcd_display_string(" Program ", 1) display.lcd_display_string(" Starting...", 2) time.sleep(10) display.lcd_clear() time.sleep(1) password.checkstart() try: while True: main_kp = keypad() main_cm = camera() main_gps = gps() main_pw = power() display.lcd_display_string("A)Phone B)Camera", 1) display.lcd_display_string("C)Park D)Power", 2) key = None while key == None: key = main_kp.getKey() if (key == "A"): time.sleep(0.4) main_kp.getNumberPhone() elif (key == "B"): time.sleep(0.4) main_cm.camera_on() elif (key == "C"): time.sleep(0.4)
def initializeGL(self): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glClearColor(1,1,1,0) self.camera=camera() self.light=Light(Materials[0])
def run(self): while not self.end: with camera() as self.cam: self.cam.capture() print "Image Taken"
world = random_scene() lookfrom = vec3(11, 5, 2) lookat = vec3(0, 0, -1) dist_to_focus = (lookfrom - lookat).length() aperture = 0.05 with open(file, 'w') as p: p.write("P3\n") p.write("{} {}\n".format(nx, ny)) p.write("255\n") for y in range(ny): print(y) for x in range(nx): col = vec3(0, 0, 0) cam = camera(lookfrom, lookat, vec3(0,1,0), 25, float(nx)/float(ny), aperture, dist_to_focus) for z in range(ns): u = float(x + random.random())/float(nx) v = float(99-y + random.random())/float(ny) r = cam.get_ray(u, v) col += color(r, world, 0) col /= float(ns) col = vec3(math.sqrt(col[0]), math.sqrt(col[1]), math.sqrt(col[2])) ir = int(255.99*col[0]) ig = int(255.99*col[1]) ib = int(255.99*col[2]) p.write("{} {} {}\n".format(ir, ig, ib))
def initializeGL(self): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) self.camera = camera()