コード例 #1
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    background.set_center_object(boy)
    boy.set_background(background)
コード例 #2
0
def enter():
    gfw.world.init(['bg', 'enemy', 'player'])

    center = get_canvas_width() // 2, get_canvas_height() // 2
    bg = InfiniteBackground('futsal_court.png', 1000, 600)
    bg.set_fixed_pos(100, 100)
    gfw.world.add(gfw.layer.bg, bg)

    global player
    player = Player()
    player.pos = bg.center
    player.bg = bg
    bg.target = player
    gfw.world.add(gfw.layer.player, player)
コード例 #3
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    background.set_center_object(boy)
    boy.set_background(background)

    global balls
    balls = [Ball() for i in range(100)]
    game_world.add_objects(balls, 1)
コード例 #4
0
ファイル: main_state.py プロジェクト: KMH8359/2019-2DGP
def enter():
    global character
    character = Character()
    game_world.add_object(character, 1)
    global pet
    pet = Pet()
    game_world.add_object(pet, 1)
    global hpBar
    hpBar = HPbar()
    game_world.add_object(hpBar, 1)
    global background
    background = Background()
    game_world.add_object(background, 0)
    global items
    items = [Bigger() for i in range(1)] + [Faster() for i in range(1)
                                            ] + [smallHP() for i in range(1)]
    game_world.add_objects(items, 1)
    global jellies
    jellies = [YellowBear()
               for i in range(35)] + [PinkBear() for i in range(33)]
    for i in range(68):
        jellies[i].x = 50 * i + 1100
        jellies[i].y = 200
    jellies[1].y = 250
    jellies[2].y = 300
    jellies[3].y = 250
    jellies[14].y = 270
    jellies[15].y = 340
    jellies[16].y = 410
    jellies[17].y = 340
    jellies[18].y = 270
    jellies[29].y = 150
    jellies[30].y = 150
    jellies[31].y = 150
    jellies[43].y = 275
    jellies[44].y = 350
    jellies[45].y = 275
    jellies[57].y = 150
    jellies[58].y = 150
    jellies[59].y = 150
    jellies[60].y = 150
    jellies[61].y = 150
    jellies[62].y = 150
    jellies[63].y = 150
    jellies[64].y = 150
    jellies[65].y = 150
    jellies[66].y = 150
    jellies[67].y = 150
    game_world.add_objects(jellies, 3)
    global maptile
    maptile = MapTile()
    game_world.add_object(maptile, 2)
    global obstacles
    obstacles = [JumpObstacle1()
                 for i in range(2)] + [JumpObstacle2() for i in range(2)] + [
                     JumpObstacle3() for i in range(2)
                 ] + [SlideObstacle1() for i in range(2)
                      ] + [SlideObstacle2() for i in range(2)]
    obstacles[7].x = 4200
    obstacles[9].x = 4400
    obstacles[3].x = 5000
    game_world.add_objects(obstacles, 4)
    global point
    point = 0
    global eat_sound
    eat_sound = load_wav('eat_sound.wav')
    eat_sound.set_volume(48)

    background.set_center_object(character)
    maptile.set_center_object(character)
    character.set_background(background)