CoinHunter.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 game.mixer.init

CoinHunter.py - import pygame as game import random as r#if...

This preview shows page 1 - 2 out of 3 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("Window Title Goes Here") gamesize = [640, 400] screen = game.display.set_mode([640,400]) #load the background and lighting and resize to fit screen background = game.image.load("background.png") background = game.transform.scale(background, gamesize) light = game.image.load("light.png") light = game.transform.scale(light, gamesize) #sounds coinsounds = game.mixer.Sound("coin.wav") game.mixer.music.load("music.mp3") game.mixer.music.play(-1) #both players have 3 sprites for simulated walking #load player 1 player1 = game.image.load("sprite1_standing.png") player1a = game.image.load("sprite1_walking1.png") player1b = game.image.load("sprite1_walking2.png") player1img = player1 #start as a standing image p1box = player1.get_rect() #load player 2 player2 = game.image.load("sprite2_standing.png") player2a = game.image.load("sprite2_walking1.png") player2b = game.image.load("sprite2_walking2.png") player2img = player2 #also standing image p2box = player2.get_rect() #initial positions qand scores of the players on screen p1box.x = 100 p1box.y = 100 p1score = 0 p2box.x = 500 p2box.y - 100

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture