Exemplo n.º 1
0
def load_level_3(level):

    global game_objects, hidden, event_stack_size, player
    global tokens_collected, max_tokens, laser, switch1, portal1

    while event_stack_size>0:
        viewport.window.pop_handlers()
        event_stack_size-=1

    event_stack_size=0
    
    game_objects=[]
    reload(world)
    world.generate_world(level)
    
    player=avatar.Avatar(batch=avatar_batch)
    game_objects.append(player)

    portal1=portal.Portal(3060,60)
    portal1.batch=main_batch
    game_objects.append(portal1)

    pyglet.clock.schedule_once(spawn_bubble,.01,25,175)
    pyglet.clock.schedule_once(spawn_bubble,.01,200,175)
    pyglet.clock.schedule_once(spawn_bubble,.01,1077,223)
    pyglet.clock.schedule_once(spawn_bubble,.01,1049,553)

    pyglet.clock.schedule_once(spawn_enemy,.01,125,175)
    pyglet.clock.schedule_once(spawn_enemy,.01,125,175)

    pyglet.clock.schedule_once(spawn_enemy,1.5,260,570)
    pyglet.clock.schedule_once(spawn_enemy,1.5,560,570)
    pyglet.clock.schedule_once(spawn_enemy,1.5,410,570)

    pyglet.clock.schedule_once(spawn_enemy,9.5,260,570)
    pyglet.clock.schedule_once(spawn_enemy,9.5,560,570)
    pyglet.clock.schedule_once(spawn_enemy,9.5,410,570)

    pyglet.clock.schedule_once(spawn_enemy,17.5,260,570)
    pyglet.clock.schedule_once(spawn_enemy,17.5,560,570)
    pyglet.clock.schedule_once(spawn_enemy,17.5,410,570)

    pyglet.clock.schedule_once(spawn_enemy,25.5,260,570)
    pyglet.clock.schedule_once(spawn_enemy,25.5,560,570)
    pyglet.clock.schedule_once(spawn_enemy,25.5,410,570)

    switch1=switch.Switch(770,90,'right')
    switch1.batch=main_batch
    game_objects.append(switch1)

    pyglet.clock.schedule_once(spawn_laser,.01,395,75)

    viewport.window.push_handlers(player.key_handler)

    pyglet.clock.schedule_interval(update,1.0/120.0)
Exemplo n.º 2
0
def load_level_4(level):

    global game_objects, hidden, event_stack_size, player, boss1
    global tokens_collected, max_tokens, laser, switch1, portal1

    while event_stack_size>0:
        viewport.window.pop_handlers()
        event_stack_size-=1

    event_stack_size=0
    
    game_objects=[]
    reload(world)
    world.generate_world(level)

    switch1=switch.Switch(1057,540,'left')
    switch1.batch=main_batch
    game_objects.append(switch1)

    boss1=boss.Boss(140,200)
    boss1.batch=main_batch
    game_objects.append(boss1)
    #pyglet.clock.schedule_once(spawn_boss,1,140,200)

    player=avatar.Avatar(batch=avatar_batch)
    game_objects.append(player)

    #gate1=gate.Gate(487,275)
    #gate1.batch=main_batch
    #game_objects.append(gate1)

    pyglet.clock.schedule_once(spawn_laser,.01,555,75)

    portal1=portal.Portal(3060,60)
    portal1.batch=main_batch
    game_objects.append(portal1)

    viewport.window.push_handlers(player.key_handler)

    pyglet.clock.schedule_interval(update,1.0/120.0)
Exemplo n.º 3
0
def load_level(level):

    global game_objects, hidden, player, event_stack_size, victory, token
    global tokens_collected, max_tokens, car_enemy, lever_timer, player_has_binder

    while event_stack_size > 0:
        viewport.window.pop_handlers()
        event_stack_size -= 1

    event_stack_size = 0

    game_objects = []
    reload(world)
    world.generate_world(level)

    if level == 1:
        pyglet.gl.glClearColor(0.75, 0.75, 0.75, 1.0)
        media_player.play()
        player = avatar.Avatar(batch=main_batch)
        game_objects.append(player)
        collectibles = spawn_tokens.spawn_tokens(1, level)
        for collectible in collectibles:
            collectible.batch = main_batch
        game_objects += collectibles

        car_enemies = spawn_car_enemy.spawn_car_enemy(18)
        for car_enemy in car_enemies:
            car_enemy.batch = main_batch
        game_objects += car_enemies

        if not player_has_binder:
            btokens = spawn_btokens.spawn_btokens(2, 1)
            for btoken in btokens:
                btoken.batch = main_batch
            game_objects += btokens

        level_timer = 50
        hud.time_label.color = (255, 255, 255, 255)

    elif level == 2:
        pyglet.gl.glClearColor(0.7, 0.8, 0.75, 1.0)
        media_player.pause()
        level_timer = 0
        hud.time_label.text = 'Time:0'
        player = avatar.Avatar2(batch=main_batch)
        game_objects.append(player)
        token = token.Token2(batch=main_batch)
        game_objects.append(token)

        teachers = spawn_teachers.spawn_teachers(1, 2)
        for teacher in teachers:
            teacher.batch = main_batch
        game_objects += teachers

    hidden = hidden_token.Hidden_token(batch=main_batch)
    hidden.x = 250
    hidden.y = 500
    hidden.update_bounding_box()
    game_objects.append(hidden)

    enemies = spawn_enemies.spawn_enemies(4, level)
    for enemy in enemies:
        enemy.batch = main_batch
    game_objects += enemies

    tokens_collected = 0
    max_tokens = 1

    viewport.window.push_handlers(player.key_handler)

    pyglet.clock.schedule_interval(update, 1.0 / 120.0)
Exemplo n.º 4
0
def start_game():

    global game_objects,pacer,coconut,gorilla,hanging_monkey,losing_screen,background
    global hanging_monkey2,rubies,door,key,player,player_lives

    game_objects=[]

    world.generate_world()

    player=avatar.Avatar(batch=main_batch)
    player.affected_by_gravity=True
    player.update_bounding_box()

    player_lives=3
    losing_screen=hud.Losing_screen()

    gorilla=enemy.Enemy(batch=main_batch)
    gorilla.affected_by_gravity=True
    game_objects.append(gorilla)
    gorilla.update_bounding_box()

    hanging_monkey=monkey.Monkey(batch=main_batch)
    game_objects.append(hanging_monkey)
    hanging_monkey.update_bounding_box()

    hanging_monkey2=monkey.Monkey(batch=main_batch)
    game_objects.append(hanging_monkey2)
    hanging_monkey2.x=700
    hanging_monkey2.y=560
    hanging_monkey2.update_bounding_box()

    chucknorris=pacer.Pacer(batch=main_batch)
    game_objects.append(chucknorris)
    chucknorris.update_bounding_box()

    coconut=coconuts.Coconut(batch=main_batch)
    coconut.x=700
    coconut.y=540
    game_objects.append(coconut)
    coconut.update_bounding_box()

    coconut2=coconuts.Coconut(batch=main_batch)
    coconut2.x=375
    coconut2.y=540
    game_objects.append(coconut2)
    coconut2.update_bounding_box()

    rubies=spawn_tokens.spawn_tokens(7)
    for ruby in rubies:
        ruby.batch=main_batch
    game_objects.extend(rubies)

    door=key_and_door.Door(batch=main_batch)
    door.affected_by_gravity=False
    game_objects.append(door)
    door.update_bounding_box()

    key=key_and_door.Key(batch=main_batch)
    key.affected_by_gravity=False
    game_objects.append(key)
    key.update_bounding_box()

    background=background.Background()

    song_sound.play()

    viewport.window.push_handlers(player.key_handler)
    pyglet.clock.schedule_interval(update,1.0/120.0)
    pyglet.clock.schedule_interval(update_main_clock,1.0)
Exemplo n.º 5
0
def load_level_1(level):

    global game_objects, hidden, event_stack_size, player
    global tokens_collected, max_tokens, laser, switch1, portal1

    while event_stack_size>0:
        viewport.window.pop_handlers()
        event_stack_size-=1

    event_stack_size=0
    
    game_objects=[]
    reload(world)
    world.generate_world(level)

    #hidden=hidden_token.Hidden_token(batch=main_batch)
    #hidden.x=250
    #hidden.y=500
    #hidden.update_bounding_box()
    #game_objects.append(hidden)

    health.healthbar.batch=main_batch
    #game_objects.append(health.healthbar)

    portal1=portal.Portal(3060,60)
    portal1.batch=main_batch
    game_objects.append(portal1)

    switch1=switch.Switch(1056,367,'left')
    switch1.batch=main_batch
    game_objects.append(switch1)

    pyglet.clock.schedule_once(spawn_laser,.01,535,75)

    #laser=power_up.Laser(1050,140)
    #laser.batch=main_batch
    #laser.x=200
    #laser.y=200
    #laser.update_bounding_box()
    #laser.batch=main_batch
    #game_objects.append(laser)

    pyglet.clock.schedule_once(spawn_bubble,.01,251,50)
    pyglet.clock.schedule_once(spawn_bubble,.01,45,325)

    pyglet.clock.schedule_once(spawn_enemy,.01,991,528)
    pyglet.clock.schedule_once(spawn_enemy,3.01,991,528)
    pyglet.clock.schedule_once(spawn_enemy,6.01,991,528)
    pyglet.clock.schedule_once(spawn_enemy,9.01,991,528)
    pyglet.clock.schedule_once(spawn_enemy,12.01,991,528)
    pyglet.clock.schedule_once(spawn_enemy,15.01,991,528)
    pyglet.clock.schedule_once(spawn_enemy,18.01,991,528)
    pyglet.clock.schedule_once(spawn_enemy,21.01,991,528)
    pyglet.clock.schedule_once(spawn_enemy,24.01,991,528)
    pyglet.clock.schedule_once(spawn_enemy,27.01,991,528)
    pyglet.clock.schedule_once(spawn_enemy,30.01,991,528)
    
    pyglet.clock.schedule_once(spawn_enemy,.01,510,25)
    pyglet.clock.schedule_once(spawn_enemy,.01,251,50)

    #collectibles=spawn_tokens.spawn_tokens(4,level)
    #for collectible in collectibles:
    #    collectible.batch=main_batch
    #game_objects+=collectibles

    #tokens_collected=0
    #max_tokens=4

    player=avatar.Avatar(batch=avatar_batch)
    game_objects.append(player)

    
    viewport.window.push_handlers(player.key_handler)

    pyglet.clock.schedule_interval(update,1.0/120.0)
Exemplo n.º 6
0
def load_level_2(level):

    global game_objects, hidden, event_stack_size, player
    global tokens_collected, max_tokens, laser, switch1, portal1

    while event_stack_size>0:
        viewport.window.pop_handlers()
        event_stack_size-=1

    event_stack_size=0
    
    game_objects=[]
    reload(world)
    world.generate_world(level)
    
    player=avatar.Avatar(batch=avatar_batch)
    game_objects.append(player)

    portal1=portal.Portal(3060,60)
    portal1.batch=main_batch
    game_objects.append(portal1)

    switch1=switch.Switch(996,365,'right')
    switch1.batch=main_batch
    game_objects.append(switch1)

    pyglet.clock.schedule_once(spawn_laser,.01,134,195)

    pyglet.clock.schedule_once(spawn_bubble,.01,205,197)
    #pyglet.clock.schedule_once(spawn_bubble,.01,755,521)
    pyglet.clock.schedule_once(spawn_bubble,.01,576,322)
    pyglet.clock.schedule_once(spawn_bubble,.01,624,322)
    #pyglet.clock.schedule_once(spawn_bubble,.01,45,325)

    pyglet.clock.schedule_once(spawn_enemy,.01,289,570)
    pyglet.clock.schedule_once(spawn_enemy,6.01,289,570)
    pyglet.clock.schedule_once(spawn_enemy,12.01,289,570)
    pyglet.clock.schedule_once(spawn_enemy,18.01,289,570)
    pyglet.clock.schedule_once(spawn_enemy,24.01,289,570)
    pyglet.clock.schedule_once(spawn_enemy,30.01,289,570)
    pyglet.clock.schedule_once(spawn_enemy,36.01,289,570)

    pyglet.clock.schedule_once(spawn_enemy,.01,900,570)
    pyglet.clock.schedule_once(spawn_enemy,11.01,900,570)
    pyglet.clock.schedule_once(spawn_enemy,20.01,900,570)
    pyglet.clock.schedule_once(spawn_enemy,30.01,900,570)
    pyglet.clock.schedule_once(spawn_enemy,40.01,900,570)
    pyglet.clock.schedule_once(spawn_enemy,50.01,900,570)
    pyglet.clock.schedule_once(spawn_enemy,55.01,900,570)
    pyglet.clock.schedule_once(spawn_enemy,60.01,900,570)
    pyglet.clock.schedule_once(spawn_enemy,65.01,900,570)
    pyglet.clock.schedule_once(spawn_enemy,70.01,900,570)
    pyglet.clock.schedule_once(spawn_enemy,75.01,900,570)
    #pyglet.clock.schedule_once(spawn_enemy,35.01,950,570)
    

    pyglet.clock.schedule_once(spawn_enemy,.01,45,45)

    viewport.window.push_handlers(player.key_handler)

    pyglet.clock.schedule_interval(update,1.0/120.0)
Exemplo n.º 7
0
def load_level(level):

    global game_objects, hidden, player, event_stack_size
    global tokens_collected, max_tokens, bg

    while event_stack_size>0:
        viewport.window.pop_handlers()
        event_stack_size-=1

    event_stack_size=0

    
    game_objects=[]
    reload(world)
    world.generate_world(level)

    bg=background.Background(level=level,batch=bg_batch)


    player=avatar.Avatar(batch=main_batch)
    player.affected_by_gravity=False #Don't change this
    game_objects.append(player)

    if level==1:

        hidden_locations=[(250,500),(250,250),(750,250),(500,250)]
        loc=random.choice(hidden_locations)
        hidden=hidden_token.Hidden_token(batch=main_batch)
        hidden.x=loc[0]
        hidden.y=loc[1]
        hidden.update_bounding_box()
        game_objects.append(hidden)

        enemies=spawn_enemies.spawn_enemies(5,level)
        for enemy in enemies:
            enemy.batch=main_batch
        game_objects+=enemies

        collectibles=spawn_tokens.spawn_tokens(4,level)
        for collectible in collectibles:
            collectible.batch=main_batch
        game_objects+=collectibles

        hud.d.x=50
        hud.d.y=50

        tokens_collected=0
        max_tokens=4
        
    elif level==2:

        player.x=50
        player.y=50
        
        pwr_up=power_up.Power_up(batch=main_batch)
        pwr_up.x=650
        pwr_up.y=450
        pwr_up.make_armed=True
        pwr_up.update_bounding_box()
        game_objects.append(pwr_up)

        enemies=spawn_enemies.spawn_enemies(6,level)
        for enemy in enemies:
            enemy.batch=main_batch
        game_objects+=enemies

        collectibles=spawn_tokens.spawn_tokens(4,level)
        for collectible in collectibles:
            collectible.batch=main_batch
        game_objects+=collectibles

        hud.d.x=1050
        hud.d.y=50
        
        tokens_collected=0
        max_tokens=4
        
    elif level==3:
        enemies=spawn_enemies.spawn_enemies(8,level)
        for enemy in enemies:
            enemy.batch=main_batch
        game_objects+=enemies

        collectibles=spawn_tokens.spawn_tokens(4,level)
        for collectible in collectibles:
            collectible.batch=main_batch
        game_objects+=collectibles

        life_up=extra_life.Extra_life(batch=main_batch)
        life_up.x=650
        life_up.y=150
        life_up.update_bounding_box()
        game_objects.append(life_up)

        hud.d.x=1050
        hud.d.y=400
        
        tokens_collected=0
        max_tokens=4

    
    viewport.window.push_handlers(player.key_handler)

    pyglet.clock.schedule_interval(update,1.0/120.0)