name = "enemy02" then -return "cross" elseif other. filter = function ( item, other ) if other. h * enemy : getScaleY ()) elseif objectName = "e02" then local enemy = Sprite_Maker. name = "exit" then -return "cross" else return "slide" end end self. player1 : getScaleY ()) elseif objectName = "e01" then local enemy = Sprite_Maker. name = "exit" then return "cross" else return "slide" end end self. name = "bullet01" then return "cross" elseif other. name = "coin01" then return "cross" elseif other. new ( "player1", "gfx/player/HQ_Trooper_all.png", 6, 13, object. name - type of object if objectName = "player" then - process player start location self. objects for i = 1, # objects do local object = objects local objectName = object. name if layerType = "imagelayer" then - process image layer here elseif layerType = "objectgroup" then local objects = layer. layers for i = 1, # layers do local layer = layers local layerType = layer. bg, true ) - TILED: process the tiled layers local level = loadfile ( "tiled/a" )() local layers = level. image, false, - TILED: the level map CBumpTiled. lastgid then return tileset end end end function CBumpTiled : init ( filename, xworld, xlayer, xtop ) - Bits on the far end of the 32-bit global tile ID are used for tile flags (flip, rotate) local FLIPPED_HORIZONTALLY_FLAG = 0x80000000 local FLIPPED_VERTICALLY_FLAG = 0x40000000 local FLIPPED_DIAGONALLY_FLAG = 0x20000000 local map = loadfile ( filename )() for i = 1, # map. class ( Sprite ) local function gid2tileset ( map, gid ) for i = 1, # map.
usage -local map = CBumpTiled.new("tiled/a", world, bg, true) - where world is the cbump world - bg is a sprite layer (here a background sprite layer) - true if only foreground is added to cbump collision world CBumpTiled = Core. ESC then scenemanager : changeScene ( "menu", 1, transitions, easing. KEY_DOWN, function ( e ) - for mobiles and desktops if e. onEnterFrame, self ) end function Level01 : onTransitionOutEnd () end - KEYS HANDLER function Level01 : myKeysPressed () self : addEventListener ( Event. onEnterFrame, self ) end function Level01 : onTransitionInEnd () self : myKeysPressed () end function Level01 : onTransitionOutBegin () self : removeEventListener ( Event.
onTransitionOutEnd, self ) end - GAME LOOP function Level01 : onEnterFrame ( e ) end - EVENT LISTENERS function Level01 : onTransitionInBegin () self : addEventListener ( Event. onTransitionOutBegin, self ) self : addEventListener ( "exitEnd", self. onTransitionInEnd, self ) self : addEventListener ( "exitBegin", self. onTransitionInBegin, self ) self : addEventListener ( "enterEnd", self. class ( Sprite ) function Level01 : init () - BG application : setBackgroundColor ( 0x1234AA ) - LISTENERS self : addEventListener ( "enterBegin", self. inOutSine = function ( ratio ) return - 0.5 * ( cos ( ratio * pii ) - 1 ) end The Bare Bone of a Scene Class outSine = function ( ratio ) return sin ( ratio * ( pii / 2 )) end easing. inSine = function ( ratio ) return 1 - cos ( ratio * ( pii / 2 )) end easing. inOutQuintic = function ( ratio ) if ratio < 0.5 then return 16 * ratio * ratio * ratio * ratio * ratio end ratio -= 1 return 16 * ratio * ratio * ratio * ratio * ratio + 1 end easing. outQuintic = function ( ratio ) ratio -= 1 return 1 + ratio * ratio * ratio * ratio * ratio end easing. inQuintic = function ( ratio ) return ratio * ratio * ratio * ratio * ratio end easing. inOutQuartic = function ( ratio ) if ratio < 0.5 then return 8 * ratio * ratio * ratio * ratio end ratio -= 1 return - 8 * ratio * ratio * ratio * ratio + 1 end easing. outQuartic = function ( ratio ) ratio -= 1 return 1 - ratio * ratio * ratio * ratio end easing. inQuartic = function ( ratio ) return ratio * ratio * ratio * ratio end easing. inOutQuadratic = function ( ratio ) if ratio < 0.5 then return 2 * ratio * ratio end return - 2 * ratio * ( ratio - 2 ) - 1 end easing. outQuadratic = function ( ratio ) return - ratio * ( ratio - 2 ) end easing. inQuadratic = function ( ratio ) return ratio * ratio end easing.
linear = function ( ratio ) return ratio end easing. inOutBack = function ( ratio ) ratio *= 2 if ratio ratio then return 0.5 * 2 ^ ( 10 * ratio ) end return 1 - 0.5 * 2 ^ ( - 10 * ratio ) end easing. outBack = function ( ratio ) ratio -= 1 return ratio * ratio * (( backS + 1 ) * ratio + backS ) + 1 end easing. inBack = function ( ratio ) return ratio * ratio * (( backS + 1 ) * ratio - backS ) end easing.