def script1(game): game.player = Allefant(game.x, game.y + game.radius - 50, 20) game.player.spawn(game.spatialhash) game.orbs.append(game.player) game.active.append(game.player) outside = InverseOrb(game.x, game.y, game.radius) outside.spawn(game.spatialhash) game.orbs.append(outside)
def load_level(old, num): game = Game(old.vw, old.vh) game.restart() game.level = num fp = data.loadblock("levels/%d" % num) for line in fp: layername, classname, remainder = line.split(None, 2) if layername == "orbs": layer = game.orbs hash = game.spatialhash elif layername == "deco": layer = game.deco hash = game.decohash if classname == "Allefant": o = Allefant.from_string(remainder) o.spawn(hash) layer.append(o) game.player = o elif classname == "InverseOrb": o = InverseOrb.from_string(remainder) o.spawn(hash) layer.append(o) else: o = globals()[classname].from_string(remainder) o.spawn(hash) layer.append(o) if classname == "Laser": game.lasers[o.id] = o if classname == "Coin": game.coins += 1 if classname == "Rider": game.rider = o if o.is_active(): game.active.append(o) return game
def script6(game): r = 400 game.player = Allefant(game.x, game.y + r - 21, 20) game.player.spawn(game.spatialhash) game.orbs.append(game.player) game.active.append(game.player) outside = InverseOrb(game.x, game.y, r) outside.spawn(game.spatialhash) game.orbs.append(outside) a = 0 r += 20 while a < math.pi * 2: x = game.x + math.sin(a) * r y = game.y + math.cos(a) * r b = game.placedeco(x, y, 18, 180 * -a / math.pi, Block1) a += 118.7 / r