def __init__(self): global grass, bg for n, speed in [(1, 30)]: bg = HorzScrollBackground('image/background1.png') bg.speed = speed grass = Grass() global zombie_time zombie_time = 1
def enter(): gfw.world.init(['bg', 'enemy', 'player']) center = get_canvas_width() // 2, get_canvas_height() // 2 for n, speed in [(1, 10), (2, 100), (3, 150)]: bg = HorzScrollBackground('cookie_run_bg_%d.png' % n) bg.speed = speed gfw.world.add(gfw.layer.bg, bg) global player player = Player() player.bg = bg gfw.world.add(gfw.layer.player, player)