Example #1
0
 def __init__(self, x, y, dir):
     super(Arrow, self).__init__(x, y)
     self.dir = dir
     self.move_speed = 14.0
     self.spritesheet = graphics.load("arrow1.png").convert_alpha()
     self.spritesheet = pygame.transform.scale(self.spritesheet, (84, 24))
     if dir == 1:
         self.spritesheet = pygame.transform.flip(self.spritesheet, True, False)
     self.box_mask = pygame.mask.from_surface(self.spritesheet)
     graphics.register(self)
Example #2
0
 def __init__(self, d, type):
     super(Fossil, self).__init__(d[0], d[1])
     self.blackBox = graphics.load("black1.png").convert_alpha()
     self.blackBox = pygame.transform.scale(self.blackBox, (45, 45))
     self.box_mask = pygame.mask.from_surface(self.blackBox)
     self.type = type
     self.spritesheet = graphics.load("fossils.png")
     self.spritesheet = pygame.transform.scale(self.spritesheet, (125, 65))
     self.mapping = {
         0: (0, 10, 41.6, 65),
         1: (45, 12, 41.6, 40),
         2: (83.3, 20, 41.6, 40)
     }
     graphics.register(self)
Example #3
0
def endScreen():
    global plane, run, clock, play, instance

    instance = -1

    graphics.background = graphics.load("images/grassy_hill.jpg")

    play = unit.Play(560, 200)
    graphics.register(play)

    plane = unit.Crashed_Plane(800, 300)
    graphics.register(plane)

    clock = pygame.time.Clock()
    run = True

    while (run):
        clock.tick(30)

        update_graphics()

    pygame.display.flip()
Example #4
0
def startScreen():
	global plane, banner, cloud1, cloud2, cloud3, cloud4, run, clock, play, instance

	instance = -1

	graphics.background = graphics.load("images/sky.jpg")

	cloud1 = unit.Cloud(randrange(0, 1400, 10), randint(0, 600))
	graphics.register(cloud1)
	cloud2 = unit.Cloud(randrange(0, 1400, 10), randint(0, 600))
	graphics.register(cloud2)

	banner = unit.Banner(530, 120)
	graphics.register(banner)

	play = unit.Play(560, 200)
	graphics.register(play)

	plane = unit.Plane(800, 100)
	graphics.register(plane)

	cloud3 = unit.Cloud(randrange(0, 1400, 10), randint(0, 600))
	graphics.register(cloud3)
	cloud4 = unit.Cloud(randrange(0, 1400, 10), randint(0, 600))
	graphics.register(cloud4)

	clock = pygame.time.Clock()
	run = True

	while (run):
		clock.tick(30)

		update_graphics()

	pygame.display.flip()
Example #5
0
def render_graphics():
	#render background
	graphics.background = graphics.load("images/sky.jpg")

	#render background clouds
	graphics.register(cloud1)
	graphics.register(cloud3)

	#render banner
	graphics.register(banner)

	graphics.register(option_cloud)
	graphics.register(option_cloud2)
	graphics.register(option_cloud3)
	graphics.register(option_cloud4)
Example #6
0
import event


# back = graphics.load("stars.png")
temp = graphics.load("Easy Maze.png")
graphics.background =  pygame.transform.scale(temp, ( 1200,  600))
#graphics.load("Easy Maze.png")
#obstacle = pygame.transform.scale(graphics.background, ( 1200,  600))

george = units.George(45, 375)
george.facing = "s_down"
#george2 = units.George(100, 25)
#george2.speed = 0.4
#george2.facing = "left"

graphics.register(george)
#graphics.register(george2)

def quit(e):
	global run
	if e.type == pygame.QUIT:
		run = False
	elif e.type == pygame.KEYUP:
		if ((e.key == pygame.K_F4) and
		   (e.mod and pygame.KMOD_ALT)):
			run = False

event.register(george.handler)
event.register(quit)

clock = pygame.time.Clock()
Example #7
0
def render_graphics():
    #render background
    graphics.background = graphics.load("images/sky.jpg")

    #render background clouds
    graphics.register(cloud1)
    graphics.register(cloud3)

    #render banner
    graphics.register(banner)

    graphics.register(option_cloud)
    graphics.register(option_cloud2)
    graphics.register(option_cloud3)
    graphics.register(option_cloud4)

    #render pattern
    if instance == 0:
        graphics.register(pyramid)
        graphics.register(sphere)
        graphics.register(pyramid2)

        graphics.register(cube)
        graphics.register(sphere2)
        graphics.register(cone)
        graphics.register(cylinder)

    if instance == 1:
        graphics.register(cone)
        graphics.register(cylinder)
        graphics.register(cone2)

        graphics.register(sphere)
        graphics.register(cylinder2)
        graphics.register(pyramid)
        graphics.register(cube)

    if instance == 2:
        graphics.register(cylinder)
        graphics.register(cube)
        graphics.register(cylinder2)

        graphics.register(sphere)
        graphics.register(cone)
        graphics.register(cube2)
        graphics.register(pyramid)

    if instance == 3:
        graphics.register(cube)
        graphics.register(pyramid)
        graphics.register(cube2)

        graphics.register(pyramid2)
        graphics.register(cone)
        graphics.register(sphere)
        graphics.register(cylinder)

    if instance == 4:
        graphics.register(sphere)
        graphics.register(cone)
        graphics.register(sphere2)

        graphics.register(cube)
        graphics.register(cone2)
        graphics.register(pyramid)
        graphics.register(cylinder)

    graphics.register(blank)

    #render plane
    graphics.register(plane)

    #render clouds
    graphics.register(cloud2)
    graphics.register(cloud4)
Example #8
0
import pygame

import graphics
import audio
import units

graphics.init()

import event

audio.init()

ava = units.Ava(25, 25)
ava.facing = "right"
graphics.register(ava)

run = True
cover = True


def handle(e):
    global run, cover
    if e.type == pygame.QUIT:
        run = False
    elif e.type == pygame.KEYUP:
        if ((e.key == pygame.K_F4) and (e.mod and pygame.KMOD_ALT)):
            run = False
        elif e.key == pygame.K_b:
            cover = not cover
            print "cover: ", cover
Example #9
0
# back = graphics.load("stars.png")
# temp = graphics.load("Easy Maze.png")
graphics.background = obstacle
# graphics.load("Easy Maze.png")
# obstacle = pygame.transform.scale(graphics.background, ( 1200,  600))

george = units.George(45, 375)
george.facing = "s_down"
collision.set_player(george)

###
fossil = units.Fossil(1100, 150, 0)
#fossil1 = units.Fossil(200, 200, 1)
#fossil2 = units.Fossil(500, 150, 2)
graphics.register(fossil)
collision.fossil = fossil
#graphics.register(fossil1)
#graphics.register(fossil2)
###

graphics.register(george)

# graphics.register(george2)


def quit(e):
    global run
    if e.type == pygame.QUIT:
        run = False
    elif e.type == pygame.KEYUP:
Example #10
0
def game_start():
    global run, scene, lawrence, sc, ents, clock, lag, restart
    restart = False
    scene = scenery.Scenery()
    lawrence = person.Person()

    for x in xrange(6, 500):
        if x % 2 == 0:
            if x < 100:
                y = random.randint(0, 7)
                if y == 1:
                    ents.append(objects.Bird((x * 90) + random.randint(0, 40)))
                elif y == 2:
                    ents.append(objects.Ball((x * 90) + random.randint(0, 40)))
                elif y == 3:
                    ents.append(objects.Cone((x * 90) + random.randint(0, 40)))
                elif y == 4:
                    ents.append(
                        objects.Hurdle((x * 90) + random.randint(0, 40)))
                elif y == 5:
                    z = random.randint(1, 3)
                    if z == 1:
                        ents.append(
                            objects.Pizza((x * 90) + random.randint(0, 40)))
                    elif z == 2:
                        ents.append(
                            objects.Hamburger((x * 90) +
                                              random.randint(0, 40)))
                    elif z == 3:
                        ents.append(
                            objects.Cheesecake((x * 90) +
                                               random.randint(0, 40)))
                elif y == 6:
                    z = random.randint(1, 3)
                    if z == 1:
                        ents.append(
                            objects.Celery((x * 90) + random.randint(0, 40)))
                    elif z == 2:
                        ents.append(
                            objects.Carrot((x * 90) + random.randint(0, 40)))
                    elif z == 3:
                        ents.append(
                            objects.Apple((x * 90) + random.randint(0, 40)))
            elif x >= 100 and x < 300:
                y = random.randint(0, 7)
                if y == 1:
                    ents.append(objects.Bird((x * 85) + random.randint(0, 40)))
                elif y == 2:
                    ents.append(objects.Ball((x * 85) + random.randint(0, 40)))
                elif y == 3:
                    ents.append(objects.Cone((x * 85) + random.randint(0, 40)))
                elif y == 4:
                    ents.append(
                        objects.Hurdle((x * 85) + random.randint(0, 40)))
                elif y == 5:
                    ents.append(objects.Cone(x * 85))
                    ents.append(objects.Cone((x * 85) + 20))
                elif y == 6:
                    z = random.randint(1, 3)
                    if z == 1:
                        ents.append(
                            objects.Pizza((x * 85) + random.randint(0, 40)))
                    elif z == 2:
                        ents.append(
                            objects.Hamburger((x * 85) +
                                              random.randint(0, 40)))
                    elif z == 3:
                        ents.append(
                            objects.Cheesecake((x * 85) +
                                               random.randint(0, 40)))
                elif y == 7:
                    z = random.randint(1, 3)
                    if z == 1:
                        ents.append(
                            objects.Celery((x * 85) + random.randint(0, 40)))
                    elif z == 2:
                        ents.append(
                            objects.Carrot((x * 85) + random.randint(0, 40)))
                    elif z == 3:
                        ents.append(
                            objects.Apple((x * 85) + random.randint(0, 40)))
            elif x >= 300:
                y = random.randint(0, 6)
                if y == 1:
                    ents.append(objects.Bird((x * 80) + random.randint(0, 40)))
                elif y == 2:
                    ents.append(objects.Ball((x * 80) + random.randint(0, 40)))
                elif y == 3:
                    ents.append(objects.Cone((x * 80) + random.randint(0, 40)))
                elif y == 4:
                    ents.append(
                        objects.Hurdle((x * 80) + random.randint(0, 40)))
                elif y == 5:
                    ents.append(objects.Cone(x * 80))
                    ents.append(objects.Cone((x * 80) + 20))
                elif y == 6:
                    ents.append(objects.Cone(x * 80))
                    ents.append(objects.Cone((x * 80) + 20))
                    ents.append(objects.Cone((x * 80) + 40))
                elif y == 7:
                    z = random.randint(1, 3)
                    if z == 1:
                        ents.append(
                            objects.Pizza((x * 80) + random.randint(0, 40)))
                    elif z == 2:
                        ents.append(
                            objects.Hamburger((x * 80) +
                                              random.randint(0, 40)))
                    elif z == 3:
                        ents.append(
                            objects.Cheesecake((x * 80) +
                                               random.randint(0, 40)))
                elif y == 8:
                    z = random.randint(1, 3)
                    if z == 1:
                        ents.append(
                            objects.Celery((x * 80) + random.randint(0, 40)))
                    elif z == 2:
                        ents.append(
                            objects.Carrot((x * 80) + random.randint(0, 40)))
                    elif z == 3:
                        ents.append(
                            objects.Apple((x * 80) + random.randint(0, 40)))

    graphics.register(scene)
    graphics.register(lawrence)
    graphics.register(sc)

    for e in ents:
        graphics.register(e)

    clock = pygame.time.Clock()
    lag = 0
    if con.audio_support:
        pygame.mixer.music.play(-1)
        audio.yay_sound.play()