#NEWLINE# def main( ) : #NEWLINE# #INDENT# global keyboard , tilemap , scroller #NEWLINE# from cocos.director import director #NEWLINE# director . init ( width = 800 , height = 600 , autoscale = False ) #NEWLINE# print ( description ) #NEWLINE# player_layer = layer . ScrollableLayer ( ) #NEWLINE# player = cocos . sprite . Sprite ( 'witch-standing.png' ) #NEWLINE# player_layer . add ( player ) #NEWLINE# player . do ( PlatformerController ( ) ) #NEWLINE# scroller = layer . ScrollingManager ( ) #NEWLINE# tilemap = tiles . load ( 'platformer-map.xml' ) [ 'level0' ] #NEWLINE# scroller . add ( tilemap , z = 0 ) #NEWLINE# scroller . add ( player_layer , z = 1 ) #NEWLINE# start = tilemap . find_cells ( player_start = True ) [ 0 ] #NEWLINE# r = player . get_rect ( ) #NEWLINE# r . midbottom = start . midbottom #NEWLINE# player . position = r . center #NEWLINE# platformer_scene = cocos . scene . Scene ( ) #NEWLINE# platformer_scene . add ( layer . ColorLayer ( 100 , 120 , 150 , 255 ) , z = 0 ) #NEWLINE# platformer_scene . add ( scroller , z = 1 ) #NEWLINE# keyboard = key . KeyStateHandler ( ) #NEWLINE# director . window . push_handlers ( keyboard ) #NEWLINE# def on_key_press( key , modifier ) : #NEWLINE# #INDENT# if ( key == pyglet . window . key . D ) : #NEWLINE# #INDENT# tilemap . set_debug ( True ) #NEWLINE# #UNINDENT# #UNINDENT# director . window . push_handlers ( on_key_press ) #NEWLINE# director . run ( platformer_scene )