Python Week 13.pptx - Python Week 12 Pygame import pygame import random import math import winsound#Intialize pygame pygame.init#Create the screen

Python Week 13.pptx - Python Week 12 Pygame import pygame...

This preview shows page 1 - 5 out of 12 pages.

Python Week 12 Pygame import pygame import random import math import winsound #Intialize pygame pygame.init() #Create the screen screen = pygame.display.set_mode((800, 600)) #Background image background = pygame.image.load('space.png')
Python Week 12 Pygame #Title and Icon pygame.display.set_caption("Space Invaders") icon = pygame.image.load('fighter.png') pygame.display.set_icon(icon) #Player playerImg = pygame.image.load('xwing.png') playerX = 370 playerY = 480 playerX_change = 0 player2Img = pygame.image.load('xwing.png') player2X = 450 player2Y = 480 player2X_change = 0
Python Week 12 Pygame #Enemy enemyImg = [] enemyX = [] enemyY = [] enemyX_change = [] enemyY_change = [] num_of_enemies = 15 for i in range(num_of_enemies): enemyImg.append(pygame.image.load('tie.png')) enemyX.append (random.randint(0, 735)) enemyY.append (random.randint(50, 150)) enemyX_change.append(4) enemyY_change.append(40)
Python Week 12 Pygame #Ready can't see bullet #Fire bullet is moving bulletImg = pygame.image.load('bullet.png') bulletX = 0

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture