Пример #1
0
def make_player(x, y):
    """
    generates list of player sprites for animation
    :param x: x coordinate
    :param y: y coordinate
    :return: list of player sprites
    """
    global frames, player_down
    images1 = gamebox.load_sprite_sheet("Textures/naked_up.png", 1, 4)
    images2 = gamebox.load_sprite_sheet("Textures/naked_down.png", 1, 4)
    images3 = gamebox.load_sprite_sheet("Textures/naked_left.png", 1, 4)
    images4 = gamebox.load_sprite_sheet("Textures/naked_right.png", 1, 4)
    player = []
    for image in images1:
        player.append(gamebox.from_image(x, y, image))
    for image in images2:
        player.append(gamebox.from_image(x, y, image))
    for image in images3:
        player.append(gamebox.from_image(x, y, image))
    for image in images4:
        player.append(gamebox.from_image(x, y, image))
    frames = 4
    for each in player:
        each.scale_by(.15)
    return player
Пример #2
0
def make_trainer(x, y):
    """
    creates enemy pokemon trainer sprites
    :param x: x coordinate
    :param y: y coordinate
    :return: trainer and trainer2 lists of sprites
    """
    images1 = gamebox.load_sprite_sheet("Textures/player_left.png", 1, 4)
    images2 = gamebox.load_sprite_sheet("Textures/player_right.png", 1, 4)
    trainer = []
    for image in images1:
        trainer.append(gamebox.from_image(x, y, image))
    for image in images2:
        trainer.append(gamebox.from_image(x, y, image))
    trainer2 = trainer
    return trainer, trainer2
Пример #3
0
def make_walker(x, y):
    global frames
    images = gamebox.load_sprite_sheet("walk_stand.png", 1, 6)
    frames = len(images)
    walker = []  # walker is a list of gameboxes
    for image in images:
        walker.append(gamebox.from_image(x, y, image))
    return walker
Пример #4
0
def make_room(width, height):
    global size, camera, zombie_pics, zombie
    size = (width, height)
    camera = gamebox.Camera(size[0] * CELLSIZE + 2 * EDGEBUFFER,
                            size[1] * CELLSIZE + 2 * EDGEBUFFER)
    zombie_pics = gamebox.load_sprite_sheet("Monster-zombie.png", 8, 7)
    zombie = gamebox.from_image(EDGEBUFFER + CELLSIZE / 2,
                                EDGEBUFFER + CELLSIZE / 2, zombie_pics[0])
    zombie.width = CELLSIZE
    look_right()
Пример #5
0
def make_squirrel(x, y):
    """
    creates 3 squirrel sprite lists
    :param x: x coordinate
    :param y: y coordinate
    :return: squirrel, squirrel2, squirrel3 sprite lists
    """
    global squirrel_frames
    images1 = gamebox.load_sprite_sheet("Textures/squirrel_left.png", 1, 3)
    images2 = gamebox.load_sprite_sheet("Textures/squirrel_right.png", 1, 3)
    squirrel = []
    for image in images1:
        squirrel.append(gamebox.from_image(x, y, image))
    for image in images2:
        squirrel.append(gamebox.from_image(x, y, image))
    squirrel2 = squirrel
    squirrel3 = squirrel
    squirrel_frames = 3
    return squirrel, squirrel2, squirrel3
Пример #6
0
def make_girl(x, y):
    """
    creates girl sprite lists
    :param x: x coordinate
    :param y: y coordinate
    :return: girl and girl2 sprite lists
    """
    global girl_frames
    images1 = gamebox.load_sprite_sheet("Textures/girl_left.png", 1, 3)
    images2 = gamebox.load_sprite_sheet("Textures/girl_right.png", 1, 3)
    girl = []
    for image in images1:
        girl.append(gamebox.from_image(x, y, image))
    for image in images2:
        girl.append(gamebox.from_image(x, y, image))
    for each in girl:
        each.scale_by(.5)
    girl2 = girl
    girl_frames = 3
    return girl, girl2
Пример #7
0
def make_police(x, y):
    """
    creates police sprite sheets
    :param x: x coordinate
    :param y: y coordinate
    :return: police and police2 sprite lists
    """
    global police_frames
    images1 = gamebox.load_sprite_sheet("Textures/police_left.png", 1, 4)
    images2 = gamebox.load_sprite_sheet("Textures/police_right.png", 1, 4)
    police = []
    for image in images1:
        police.append(gamebox.from_image(x, y, image))
    for image in images2:
        police.append(gamebox.from_image(x, y, image))
    for each in police:
        each.scale_by(.25)
    police2 = police
    police_frames = 4
    return police, police2
Пример #8
0
def make_wackman(x, y):
    '''
    makes wackman
    :param x: x-coordinate
    :param y: y-coordinate
    :return: list of images from sprite
    '''
    global frames
    images = gamebox.load_sprite_sheet("george.png", 4, 4)
    frames = len(images)
    image_list = []
    for image in images:
        image = pygame.transform.scale(image, (width // 25, height // 20))
        image_list.append(gamebox.from_image(x, y, image))
    return image_list
Пример #9
0
def make_cobras(x, y):
    '''
    makes image list from sprite
    :param x: x-coordinate
    :param y: y-coordinate
    :return: image list
    '''
    global frames
    cobra_images = gamebox.load_sprite_sheet("king_cobra-red.png", 4, 3)
    frames = len(cobra_images)
    cobra_image_list = []
    for image in cobra_images:
        image = pygame.transform.scale(image, (width // 25, height // 20))
        cobra_image_list.append(gamebox.from_image(x, y, image))
    return cobra_image_list
Пример #10
0
def draw_standing_person():
    """This function iterates through all the images in the spritesheet and reassigns it to the player gamebox.
    It also flips the images depending on whether the person is moving left or right"""
    global player, cart
    if standing:
        standing_sheet = gamebox.load_sprite_sheet('standing_sprite_sheet.png',
                                                   4, 4)
        player.image = standing_sheet[(timer // 2) % len(standing_sheet)]
        player.speedx = 0
    if not standing:
        player.image = running_sheet[(timer // 2) % len(running_sheet)]
    if not left:
        cart.x = player.x + 140
    if left:
        cart.x = player.x - 140
    player.move_speed()
    camera.draw(player)
    camera.draw(cart)
Пример #11
0
 def __init__(self, player, screenObj=None, world_unit=None):
     """Constructor"""
     self.world_unit = world_unit
     self.images = load_sprite_sheet("Witchcraft.png", 1, 22)
     self.image_num = 0
     self.player = player
     self.player.con = self
     self.dy = 0
     self.dx = 0
     self.direction = 1
     self.label1 = UI.Label(
         300, 300, " player gold:{}".format(self.player.booty["Gold"]))
     if screenObj is not None:
         self.screen_obj = screenObj
     else:
         self.screen_obj = UI.ScreenUnit(player.current_tile.world_x,
                                         player.current_tile.world_y,
                                         self.images[0], 15, 15, False,
                                         self.controls)
         from UI import cam
         cam.center_on(self.screen_obj)
Пример #12
0
p2_stat = 0
p1_xhitspeed = 0
p2_xhitspeed = 0
p1_yhitspeed = 0
p2_yhitspeed = 0
p1_punches = {"punch1": 0, "punch2": 0, "punch3": 0}
p2_punches = {"punch1": 0, "punch2": 0, "punch3": 0}
stock_box = gamebox.from_color(320, 300, "red", 125, 70)
time_box = gamebox.from_color(960, 300, "green", 125, 70)
mode = "time"
submode = 1
winner = ""
p1_airjump = True
p2_airjump = True

p1_charsheet = gamebox.load_sprite_sheet("Char1_Spritesheet.png", 2, 9)
p2_charsheet = gamebox.load_sprite_sheet("Char2_spritesheet.png", 2, 9)
p2_char = gamebox.from_image(0, 0, p2_charsheet[0])
p1_char = gamebox.from_image(0, 0, p1_charsheet[0])
extra_hit1 = gamebox.from_image(0, 0, p1_charsheet[7])
extra_hit2 = gamebox.from_image(0, 0, p2_charsheet[7])
p1_showtime = 0
p1_hitshowtime = 0
p2_showtime = 0
p2_hitshowtime = 0
p1_hittime = 0
p2_hittime = 0
p2_charrunning = gamebox.load_sprite_sheet("Char2_running.png", 2, 15)
p1_charrunning = gamebox.load_sprite_sheet("Char1_running.png", 2, 11)
r2 = 0
r1 = 0
Пример #13
0
# pharma game

import pygame
import gamebox
import random
from pygame.locals import *

camera = gamebox.Camera(800, 750)
display = pygame.display.set_mode((800, 750))
image = pygame.image.load("hospital.jpg")

sheet1 = gamebox.load_sprite_sheet(
    "https://3.bp.blogspot.com/-_NVjscKbE7Q/WLB4GtYM6PI/AAAAAAAAIyk/iGm67QmaiV0v0VKNSnG5pzenizWGsbvyQCLcB/s1600/trump_run.png",
    4, 6)

sheet1 = [
    sheet1[6],
    sheet1[7],
    sheet1[8],
    sheet1[9],
    sheet1[10],
    sheet1[11],
]

obstacles = [
    # patient room
    gamebox.from_color(625, 315, 'green', 20, 20),
    # pharmacy room
    gamebox.from_color(295, 630, 'green', 20, 20),
    gamebox.from_color(340, 255, 'green', 20, 20),
    gamebox.from_color(135, 375, 'green', 20, 20),
Пример #14
0
import pygame
import gamebox
import random

camera = gamebox.Camera(800, 600)

platforms = []
for y in range(0, 600, 100):
    platforms.append(
        gamebox.from_color(random.randrange(0, 800), y, 'black',
                           random.randrange(100, 500), 20))

images = gamebox.load_sprite_sheet('spritesheet.png', 1, 4)
player = gamebox.from_image(400, 0, images[1])
player.height = 100

platforms[5].x = player.x

frame = 0


def tick(keys):
    global frame
    frame += 1
    camera.clear('cyan')

    walking = False

    # player horizontal motion
    if pygame.K_RIGHT in keys:
        walking = True
Пример #15
0
planet1.scale_by(.07)
planet2 = gamebox.from_image(600, 180, 'planet2.png')
planet2.scale_by(.07)
planet3 = gamebox.from_image(600, 280, 'planet3.png')
planet3.scale_by(.12)
planet4 = gamebox.from_image(600, 380, 'planet4.png')
planet4.scale_by(.12)
planet5 = gamebox.from_image(600, 480, 'planet5.png')
planet5.scale_by(.12)
planet6 = gamebox.from_image(600, 545, 'planet6.png')
planet6.scale_by(.07)
planets = [planet1, planet2, planet3, planet4, planet5, planet6]
spaceship = gamebox.from_image(330, 50, 'spaceship.png')
spaceship.scale_by(.25)
number_of_frames = 8
sheet = gamebox.load_sprite_sheet("comet_spritesheet.png", 8, 8)
frame = 0
counter = 0
comet = gamebox.from_image(50, 300, sheet[frame])
comet.scale_by(.5)
stars = []
counter = 0
radians = 0
scores = 0
ticks_time = 900
ticks = 0


def start():
    start_box1 = gamebox.from_text(400, 100, "ASTEROIDS VS ASTRONAUTS", 24,
                                   "white")
Пример #16
0
import pygame, gamebox

#objects
camera = gamebox.Camera(1400,600)

walkSheet = gamebox.load_sprite_sheet( "Rambo Walk.png", 1,4)
gunSheet = gamebox.load_sprite_sheet("Rambo Gun.png",1,4)
badTankSheet = gamebox.load_sprite_sheet('badTank.png',1,7)
uvaTankSheet = gamebox.load_sprite_sheet('UVATank.png',1,7)
vtVillanSheet = gamebox.load_sprite_sheet('vtBadGuy.png',1,4)
explosionSheet = gamebox.load_sprite_sheet('explosion.png',1,3)
flyRambo = gamebox.from_image(0,0,'flyRambo.png')
flySheet = gamebox.load_sprite_sheet('flySheet.png',1,4)
coverPic = gamebox.from_image(700,300,'CoverPic.png')


wallList = [ gamebox.from_color(3500,600,"black",8000,100),
            gamebox.from_color(350,380,"black",300,25),gamebox.from_color(4900,380,'black',600,25),
             gamebox.from_color(11500,600,"black",6000,100),gamebox.from_color(7870,380,"black",400,25),
             gamebox.from_color(8300,280,"black",300,25),gamebox.from_color(15900,550,'black',2000,200),
             ]

weaponList = [gamebox.from_image(350,340,'MachineGun.png'),gamebox.from_image(10000,460,'unmannedTank.png'),
              gamebox.from_image(16300,420,'flyBoot.png')]

villanList = [gamebox.from_image(2500,468,vtVillanSheet[0]),gamebox.from_image(1500,468,vtVillanSheet[0]),
              gamebox.from_image(2000,468,vtVillanSheet[0]),gamebox.from_image(5000,468,vtVillanSheet[0]),
              gamebox.from_image(5200,468,vtVillanSheet[0]),gamebox.from_image(5400,468,vtVillanSheet[0]),
              gamebox.from_image(8400,0,vtVillanSheet[0]),gamebox.from_image(10500,468,vtVillanSheet[0]),
              gamebox.from_image(10700,468,vtVillanSheet[0]),gamebox.from_image(10900,468,vtVillanSheet[0]),
              gamebox.from_image(16000,368,vtVillanSheet[0]),gamebox.from_image(16200,368,vtVillanSheet[0])]
Пример #17
0
box = gamebox.from_text(40, 200, "HE", "Arial", 35, "red")

lava = gamebox.from_color(camera.x, camera.bottom, 'red', randsize, 40)
coins = [
    gamebox.from_image(
        random.randrange(camera.right + 100, camera.right + 300),
        random.randrange(220, 300), "coin.png"),
    gamebox.from_image(
        random.randrange(camera.right + 100, camera.right + 300),
        random.randrange(220, 300), "coin.png"),
    gamebox.from_image(
        random.randrange(camera.right + 100, camera.right + 300),
        random.randrange(220, 300), "coin.png")
]

sheet = gamebox.load_sprite_sheet(
    "https://highergroundz.files.wordpress.com/2012/07/runningman2.png", 2, 5)
print(sheet)

coins_got = 0

show_splash = True
ticks = 0

musicplayer0 = music.play(-1)


def splash(keys):
    global show_splash, ticks
    camera.clear('red')
    text = gamebox.from_text(camera.x, camera.y, "ACID RAIN RUN", "Arial", 20,
                             'black')
Пример #18
0
            if line > max:
                max = int(line)
        return str(max)


# title and instruction screens
Width, Length = 800, 700
camera = gamebox.Camera(Width, Length)
imageLink = "https://virginia.box.com/shared/static/"  # used to shorten code in the future

# music
music = gamebox.load_sound(imageLink + "cb5aac92sf9r1zm9ztmb5vxu7g19s4pa")
musicplayer3 = music.play(-1)

# loading screens
splashscreen1 = gamebox.load_sprite_sheet(
    imageLink + "v661x3zpy4fge6wi8ubbinp3ey0r4495", 1, 16)
splashscreen1dummy = gamebox.from_color(camera.x, camera.y, 'black', 800, 700)
splashscreen2 = gamebox.load_sprite_sheet(
    imageLink + "g7wvy29g47qjgkrdobmiqctyuhxnjtil", 1, 16)
splashscreen2dummy = gamebox.from_color(camera.x, camera.y, 'black', 800, 700)

# conditions that control appearance of menus and other items
game_on = False
g_on = False

# used for animation of ship sprites
SHIPSHEETCOUNT = 5
positionLog = [600]
animationLog = [5]

# boundaries to keep player on the screen
Пример #19
0
radius = 250
platform_x = 1500
platform_length = 500
platform_end = 1750
prev_length = 0
prev_end = 0
prev_x = 0
prev_radius = 0
platform_end

time_on = 300

y=0

blue_hole_sheet = gamebox.load_sprite_sheet("http://people.virginia.edu/~mak2vr/files/alien/bluehole.png",1,5)
x = 1500

blueholes = []


score = 0

speed = 10

def tick(keys):

    for bluehole in blueholes:
        bluehole.scale_by(1.018)

    global x, score, y, platform_x, time_on, speed, platform_length, platform_end, prev_length, prev_end, prev_x, radius, prev_radius
Пример #20
0
Optional Features:
    Multiple levels
    Scrolling levels
    Animations
    Timer

"""

import gamebox
import pygame

number_of_frames_run = 16
number_of_frames_fall = 4
camera = gamebox.Camera(800, 600)
sonic = gamebox.from_image(camera.x, camera.y, 'sonics.png')
sonic_run_sheet = gamebox.load_sprite_sheet("sonics_run.png", 1, 16)
sonic_run_sheet_left = gamebox.load_sprite_sheet('sonics_run_left.png', 1, 16)
sonic_idle_sheet = gamebox.load_sprite_sheet('sonics.png', 1, 1)
sonic_idle_sheet_left = gamebox.load_sprite_sheet('sonics_left.png', 1, 1)
sonic_jump_sheet = gamebox.load_sprite_sheet('sonic_jump.png', 1, 3)
sonic_jump_sheet_left = gamebox.load_sprite_sheet('sonic_jump_left.png', 1, 3)
sonic_in_air_sheet = gamebox.load_sprite_sheet('sonic_in_air.png', 1, 1)
sonic_in_air_sheet_left = gamebox.load_sprite_sheet('sonic_in_air_left.png', 1,
                                                    1)
sonic_fall = gamebox.load_sprite_sheet('sonic_fall.png', 1, 4)
sonic.scale_by(3)
temp_ground = gamebox.from_color(camera.x, camera.y + 200, 'green', 800, 100)
pikachu = gamebox.from_image(camera.x, camera.y, 'pikachus.png')
pikachu_idle_sheet = gamebox.load_sprite_sheet('pikachu_idle.png', 1, 1)
pikachu_idle_sheet_left = gamebox.load_sprite_sheet('pikachu_idle_left.png', 1,
                                                    1)
Пример #21
0
# Cesar Roucco-Montanez (cr3fd)

# What to be implemented: 1. Spirits/Characters, 2. Collectables, 3. Health Bar, 4. Sound/music, 5. Two players
import pygame
import gamebox
import random

character_score = 0
character_health = 100
computer_score = 0
computer_health = 100
game_on = False

camera = gamebox.Camera(800, 600)
backsheet = gamebox.load_sprite_sheet(
    "http://openbookproject.net/thinkcs/python/english3e/_images/background.png",
    1, 1)
sheet = gamebox.load_sprite_sheet(
    "http://openbookproject.net/thinkcs/python/english3e/_images/duke_spritesheet.png",
    1, 10)
sheet2 = gamebox.load_sprite_sheet("http://i.stack.imgur.com/WRTsK.png", 1, 8)
coin_sound = gamebox.load_sound("coin.wav")
scream_sound = gamebox.load_sound("scream1.wav")
frame = 0
frame2 = 0
counter = 0
counter2 = 0
back = gamebox.from_image(400, 300, backsheet[0])
character = gamebox.from_image(200, 200, sheet[frame])
computer = gamebox.from_image(500, 500, sheet2[frame2])
coin = gamebox.from_color(random.randint(200, 500), random.randint(200, 500),
Пример #22
0
For example, the probability of the enemies spawning will increase if the timer goes over a certain number.

Animations: There will be animations for the main character when attacking and blocking.  Another animation will be
for when the spikes above the platforms fall, which will also force the main character to keep moving.
"""

import pygame
import gamebox
import random

camera = gamebox.Camera(800, 600)

score = 0
grav_counter = 0

jump_sheet = gamebox.load_sprite_sheet("game-assets/jump-sprite1.png", 5, 1)
player = gamebox.from_image(200, 350, jump_sheet[0])
player.speedy = 0
platforms = [
    gamebox.from_color(0, 500, (0, 153, 76), 100, 30),
    gamebox.from_color(100, 500, (0, 153, 76), 100, 30),
    gamebox.from_color(200, 500, (0, 153, 76), 100, 30),
    gamebox.from_color(300, 500, (0, 153, 76), 100, 30),
    gamebox.from_color(400, 500, (0, 153, 76), 100, 30),
    gamebox.from_color(500, 500, (0, 153, 76), 100, 30),
    gamebox.from_color(600, 500, (0, 153, 76), 100, 30),
    gamebox.from_color(700, 500, (0, 153, 76), 100, 30),
    gamebox.from_color(800, 500, (0, 153, 76), 100, 30),
    gamebox.from_color(900, 500, (0, 153, 76), 100, 30)
]
plat_counter = 0
Пример #23
0
tree=gamebox.from_image(300,470, "http://www.dumbmanex.com/bynd_freestuff.html/s_gantmound_idle.png")
tree.scale_by(3)
tree2=gamebox.from_image(2000,445, "http://img00.deviantart.net/81fd/i/2013/333/f/1/spooky_tree_06_png_stock_by_jumpfer_stock-d6w1uxf.png")
tree2.scale_by(.2)
house=gamebox.from_image(6800,150, "http://orig12.deviantart.net/2bcb/f/2013/084/f/a/png_____country_house_i_by_fumar_porros-d5z8f5g.png")
house.scale_by(.5)
signs=[
    gamebox.from_image(120, 520, "http://www.gameart2d.com/free-platformer-game-tileset.html/Sign_2.png"),
    gamebox.from_image(1630, 525, "http://www.gameart2d.com/free-platformer-game-tileset.html/Sign_2.png"),
    gamebox.from_image(3770, 425, "http://www.gameart2d.com/free-platformer-game-tileset.html/Sign_2.png"),
    gamebox.from_image(3700, -30, "http://www.gameart2d.com/free-platformer-game-tileset.html/Sign_2.png"),
    gamebox.from_image(5400, 15, "http://www.gameart2d.com/free-platformer-game-tileset.html/Sign_2.png")
]

#Character
sheet = gamebox.load_sprite_sheet("http://img.webme.com/pic/e/ego-rpgmaker/cloudbp5.png",4,4)
counter = 0
frame=0
character1 = gamebox.from_image(200,200, sheet[frame])
character1.speedy = 0

walls = [
    gamebox.from_color(100, 600, "dark green", 800, 100), gamebox.from_color(100, 1250, "deep sky blue", 90000, 400),
    gamebox.from_color(750, 380, "dark green", 200, 40), gamebox.from_color(1050, 500, "dark green", 200, 40),
    gamebox.from_color(1900, 600, "dark green", 700, 90), gamebox.from_color(4000, 500, "dark green", 700, 90),
    gamebox.from_color(3800, 20, "dark green", 300, 40), gamebox.from_color(5600, 90, "dark green", 700, 90),
    gamebox.from_color(6600, 380, "dark green", 800, 100),
    gamebox.from_image(1800, 400, "http://www.dumbmanex.com/bynd_freestuff.html/b_symswamp_top.png"),
    gamebox.from_image(2000, 200, "http://www.dumbmanex.com/bynd_freestuff.html/b_symswamp_top.png"),
    gamebox.from_image(2500, 600, "http://www.dumbmanex.com/bynd_freestuff.html/b_posiplain_inside.png"),
    gamebox.from_image(2700, 750, "http://www.dumbmanex.com/bynd_freestuff.html/b_posiplain_inside.png"),
Пример #24
0
# Haoyu Li hl6de
# Rickey Guo rg7cz
# We acknowledge Luther Tychonievich for his gamebox code.

import pygame
import gamebox
import random

camera = gamebox.Camera(400, 600)
# the below are characters, done
number_of_frame_character = 3
sheet = gamebox.load_sprite_sheet("img/jet.png", 8, number_of_frame_character)
frame_character = 0
frame_right = 3
frame_left = 12
character = gamebox.from_image(200, 300, sheet[frame_character])
cannon = gamebox.from_color(character.x, character.y, "white", 10, 10)
bullet = []  # empty list for appending bullets to be shot
background = [
    gamebox.from_image(200, 300, "img/background.jpg"),
    gamebox.from_image(200, -300, "img/background.jpg")
]

# the boundary of the screen, do not change (done)
boundary = [
    gamebox.from_color(200, 0, "black", 400, 10),
    gamebox.from_color(200, 600, "black", 400, 10),
    gamebox.from_color(0, 300, "black", 10, 600),
    gamebox.from_color(400, 300, "black", 10, 600)
]
import pygame
import gamebox
import random

# camera
camera = gamebox.Camera(800, 600)

# player ship
player_animations = gamebox.load_sprite_sheet("PlayerSprite.png", 1, 6)
player = gamebox.from_image(400, 550, player_animations[0])
# player = gamebox.from_color(400, 550, "red", 30, 30)

# default bullets
bullet1 = gamebox.from_color(-5, 520, "yellow", 5, 5)
bullet2 = gamebox.from_color(-5, 520, "yellow", 5, 5)
bullet3 = gamebox.from_color(-5, 520, "yellow", 5, 5)
bullets = [bullet1, bullet2, bullet3]

# enemies and their weapons
enemies = []
en_bullet1 = gamebox.from_color(-5, 520, "red", 5, 5)
en_bullet2 = gamebox.from_color(-5, 520, "red", 5, 5)
en_bullet3 = gamebox.from_color(-5, 520, "red", 5, 5)
en_bullets = [en_bullet1, en_bullet2, en_bullet3]

enemy_animations = gamebox.load_sprite_sheet("EnemySprite.png", 1, 6)

def create_enemy():
    # enemy = gamebox.from_color(random.randint(0, 800), random.randint(0,2) * 75 + 50, "yellow", 50, 50)
    enemy = gamebox.from_image(random.randint(0, 800), random.randint(0, 2) * 75 + 50, enemy_animations[0])
Пример #26
0
import pygame
import gamebox
import random

camera = gamebox.Camera(800, 600)
game_started = False
title_snake = []
tick_count = 0
images_sr = gamebox.load_sprite_sheet('sr.png', 4, 4)
for i in range(12):
    s_right = gamebox.from_image(-(100 * i), 500, images_sr[9])
    s_right.speedx = 5
    title_snake.append(s_right)

instructions = '''
    Some Instructions here.
    Maybe collecting the coins.
'''


def startframe(keys):
    '''
    Draw title screen
    '''
    global game_started
    global tick_count

    if keys:
        game_started = True
    keys.clear()
Пример #27
0
# free sprites courtesy of Sithjester

import pygame
import gamebox

pygame.mixer.music.load("sound.wav")
pygame.mixer.music.play(-1)

flag_sound = pygame.mixer.Sound("sound.wav")
goal_sound = pygame.mixer.Sound("sound.wav")

camera = gamebox.Camera(800,600)
player_one_sheet = gamebox.load_sprite_sheet("http://untamed.wild-refuge.net/images/rpgxp/avengers/blackwidow.png", 4, 4)
player_two_sheet = gamebox.load_sprite_sheet("http://untamed.wild-refuge.net/images/rpgxp/avengers/steverogers.png", 4, 4)

#add monster sprite sheet
monster_sheet = gamebox.load_sprite_sheet("http://untamed.wild-refuge.net/images/rpgxp/avengers/hulk.png", 4, 4)


player_one_frame = 8
player_two_frame = 4

#starting frame of monster looking downards
monster_frame  = 12

timer = 30*60
direction = 0
counter = 0

player_one = gamebox.from_image(350, 300, player_one_sheet[player_one_frame])
player_two = gamebox.from_image(450, 300, player_two_sheet[player_two_frame])
Пример #28
0
## DEFINING CHARACTERS AND SPRITESHEETS
player1x = random.randint(150, 300)
player1y = 400

player1 = gamebox.from_color(player1x, player1y, 'red', 10, 10)
player1trail = [gamebox.from_color(player1x, player1y, 'red', 10, 10)]

player2x = random.randint(500, 650)
player2y = 400

player2 = gamebox.from_color(player2x, player2y, 'blue', 10, 10)
player2trail = [gamebox.from_color(player2x, player2y, 'blue', 10, 10)]

## DEFINING EXPLOSIONS
explosionsprite = gamebox.load_sprite_sheet("explosionsprite.png", 4, 4)

p1boom = gamebox.from_image(player1x, player1y, explosionsprite[9])

explosions = []

## BOOLEAN MOVEMENT VARIABLES FOR PLAYERS 1 AND 2

p1north = True
p1south = False
p1east = False
p1west = False

p2north = True
p2south = False
p2east = False
Пример #29
0
cash = 100
tank_count = 1
timer = 45
tick_count = 0

wave_started = False

PRE_WAVE_TIME = 30
TANK_VALUE = 100

# Camera
camera = gamebox.Camera(800, 600)

# Images
tank_image_url = "http://www.xnaresources.com/images/tutorialimages/sprites/MulticolorTanks.png"
tank_sprite_sheet = gamebox.load_sprite_sheet(tank_image_url, 8, 8)

background_path = "background001.png"
background = gamebox.from_image(400, 300, background_path)

boom_image_url = "http://flashvhtml.com/html/img/action/explosion/Explosion_Sequence_A%2012.png"
tankstuff.Boom.image = boom_image_url

mine_image_path = "mine001.png"
tankstuff.Mine.image = mine_image_path

#Game Objects
enemy_tanks = []
friendly_tanks = []
bullets = []
barriers = []
Пример #30
0
# obstacles (fire, stone, rect) and boundary (floor)
fire = gamebox.from_image(random.randint(100, 700), -100, 'fire.png')
stone = gamebox.from_image(random.randint(100, 700), -100, 'stone.png')
rect = gamebox.from_image(random.randint(900, 1000), random.randint(100, 400),
                          'rect.png')
floor = gamebox.from_color(400, 510, 'brown', 800, 5)
fire.scale_by(0.08)
rect.scale_by(0.2)
stone.scale_by(0.08)
obs = [rect]
falling = [fire, stone]

# coin (Credit to one of the CS professors: Craig Dill. Xinyu adopted his idea of using coins as collectibles and
# altered some codes to make the coin an animation.)
number_of_frames = 6
sheet = gamebox.load_sprite_sheet("coin.png", 1, number_of_frames)
frame = 0
counter = 0
coin = gamebox.from_image(400, 300, sheet[frame])
coin.scale_by(.5)
coin_lst = [coin]
time1 = 0

# score
score = 0

# timer
survival_time = 0

# health meter
health_meter = 5
Пример #31
0
# Mark Sherriff animated sprite using a sprite sheet

# import pygame
import gamebox

camera = gamebox.Camera(800, 600)
sheet = gamebox.load_sprite_sheet(
    "http://estelle.github.io/10/files/sprite.png", 1, 22)
frame = 0
direction = 0
sprite_counter = 0
character = gamebox.from_image(200, 200, sheet[frame])


def tick(keys):
    global frame
    global direction
    global sprite_counter

    frame += 1
    sprite_counter += 1
    if frame == 10:
        frame = 0
    if sprite_counter % 1 == 0:
        character.image = sheet[frame + direction * 10]

    camera.clear("white")
    camera.draw(character)
    camera.display()

Пример #32
0
powerup_wrap = []
coins1 = []
coins2 = []
coins3 = []
coins4 = []

powerup_bomb = []
points = 0
wall_left = gamebox.from_color(0, 400, 'cyan', 15, 800)
wall_right = gamebox.from_color(600, 400, 'cyan', 15, 800)
colors = [
    'green', 'cyan', 'yellow', 'magenta', 'orange', 'blue1', 'chartreuse1',
    'deeppink1'
]
sheet = gamebox.load_sprite_sheet(
    'http://www.williammalone.com/articles/create-html5-canvas-javascript-sprite-animation/images/coin-sprite-animation-sprite-sheet.png',
    1, 10)
#sheet = gamebox.load_sprite_sheet('ball_sprite.png',8,12)
frame = 0
ball = gamebox.from_color(300, 100, 'red', 21, 21)
highscore = 0
game_sound = gamebox.load_sound("arcade_music.wav")
coin_sound = gamebox.load_sound('coin_sound.wav')
bomb_sound = gamebox.load_sound('bomb_sound.wav')
splat_sound = gamebox.load_sound('splat_sound.wav')
speed_sound = gamebox.load_sound('speed_sound.wav')
wrap_sound = gamebox.load_sound('paddle.wav')
end_game_timer = 0


def tick(keys):
Пример #33
0
import pygame
import gamebox
import random

# camera
camera = gamebox.Camera(800, 600)

# player ship
player_animations = gamebox.load_sprite_sheet("PlayerSprite.png", 1, 6)
player = gamebox.from_image(400, 550, player_animations[0])
# player = gamebox.from_color(400, 550, "red", 30, 30)

# default bullets
bullet1 = gamebox.from_color(-5, 520, "yellow", 5, 5)
bullet2 = gamebox.from_color(-5, 520, "yellow", 5, 5)
bullet3 = gamebox.from_color(-5, 520, "yellow", 5, 5)
bullets = [bullet1, bullet2, bullet3]

# enemies and their weapons
enemies = []
en_bullet1 = gamebox.from_color(-5, 520, "red", 5, 5)
en_bullet2 = gamebox.from_color(-5, 520, "red", 5, 5)
en_bullet3 = gamebox.from_color(-5, 520, "red", 5, 5)
en_bullets = [en_bullet1, en_bullet2, en_bullet3]

enemy_animations = gamebox.load_sprite_sheet("EnemySprite.png", 1, 6)


def create_enemy():
    # enemy = gamebox.from_color(random.randint(0, 800), random.randint(0,2) * 75 + 50, "yellow", 50, 50)
    enemy = gamebox.from_image(random.randint(0, 800),
Пример #34
0
    title_text = gamebox.from_text(400, 50, 'Standoff!', 80, 'white', True, True)
    title_boxes.append(title_text)


    ypos = 400
    for line in instructions.split('\n'):
        title_boxes.append(gamebox.from_text(400, ypos, line, 30, 'white'))
        ypos += 30
    for box in title_boxes:
        camera.draw(box)
##############


#Characters
images = gamebox.load_sprite_sheet("animated.png",1,4)
p2images = gamebox.load_sprite_sheet("animated2.png",1,4)
p1 = gamebox.from_image(40, 400, "p1.png")
p1.scale_by(0.2)
p2 = gamebox.from_image(760, 400, "p2.png")
p2.scale_by(0.2)

#top and bottom stoppers
topwall = gamebox.from_color(400, 0, "black", 800, 1)
bottomwall = gamebox.from_color(400, 600, "black", 800, 1)
rounds = False
time_left = 60
player1_HP = 100
player2_HP = 100
#character movement