def __init__(self): self.foreground = game.engine.layers[1] self.background = game.engine.layers[2] self.clouds = 0.0 self.foreground.setup(Tilemap.fromfile("layer_foreground.tmx")) self.background.setup(Tilemap.fromfile("layer_background.tmx")) self.spriteset_vanish = Spriteset.fromfile("effect_vanish") self.seq_vanish = Sequence.create_sprite_sequence( self.spriteset_vanish, "vanish", 4) self.x = 0 self.x_max = self.foreground.width - game.WIDTH self.objects = load_objects(game.ASSETS_PATH + "/layer_foreground.tmx", "Capa de Objetos 1", 973) game.engine.set_background_color(self.background.tilemap) game.actors.append(self)
def setup_layer(layer, name): tilemap = Tilemap.fromfile(name) layer.setup(tilemap) engine.set_background_color(tilemap)
scale = lerp(line, 24, HEIGHT, 0.2, 5.0) affine.sx = scale affine.sy = scale background.set_transform(affine.angle, affine.dx, affine.dy, affine.sx, affine.sy) # setup engine engine = Engine.create(WIDTH, HEIGHT, 2, 0, 0) engine.set_background_color(Color(0, 0, 0)) foreground = engine.layers[0] background = engine.layers[1] # load resources engine.set_load_path("assets/smk") map_horizon = Tilemap.fromfile("track1_bg.tmx") map_track = Tilemap.fromfile("track1.tmx") # set raster callback engine.set_raster_callback(raster_effect) # main loop window = Window.create() while window.process(): foreground.setup(map_horizon) background.setup(map_horizon) foreground.set_position(lerp(angle * 2, 0, 360, 0, 256), 24) background.set_position(lerp(angle, 0, 360, 0, 256), 0) background.reset_mode() # input: turn left/right
def setup_layer(layer, name): tilemap = Tilemap.fromfile(name) layer.setup(tilemap)
import sys sys.path.append("../src") from tilengine import Engine, Window, Tilemap engine = Engine.create(400, 240, 1, 0, 20) engine.set_load_path("assets/sonic") foreground = Tilemap.fromfile("Sonic_md_fg1.tmx") engine.layers[0].setup(foreground) window = Window.create() while window.process(): window.draw_frame()