Final_Game_Projects.py - import pygame as game import random as r#if you are using sound you need this game.mixer.pre_init(44100-16 2 2048

Final_Game_Projects.py - import pygame as game import...

This preview shows page 1 - 2 out of 2 pages.

import pygame as game import random as r #if you are using sound you need this game.mixer.pre_init(44100, -16, 2, 2048) game.mixer.init() game.init() game.display.set_caption("Space Race!") gamesize = [640,400] astroidsize = [50,50] spaceshipsize = [75,75] whitelinesize = [50,400] screen = game.display.set_mode(gamesize) bgcolor = game.color.Color("black") #images for game spaceship = game.image.load("spaceship.png") spaceship = game.transform.scale(spaceship, spaceshipsize) astroid = game.image.load("astroid.png") astroid = game.transform.scale(astroid, astroidsize) line = game.image.load("whiteline.png") life = game.image.load("healthbar.png") health = game.image.load("health.png") background = game.image.load("background.png") background = game.transform.scale(background,gamesize) whiteline = game.image.load("whiteline.png") whiteline = game.transform.scale(whiteline, whitelinesize) gameon=True time = 0 healthpoints = 590 #colors: black = game.color.Color("#000000") #text for time font = game.font.Font(None, 20) timetext = font.render("Time: 0", 0, black) spaceshiphitbox = spaceship.get_rect() spaceshiphitbox.x = 100 spaceshiphitbox.y = 300

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture