def on_widget_focus(self, event): scale = SharedObjects.getScale() + self.interval if scale < 1: scale -= self.interval SharedObjects.setScale(scale) SharedObjects.setRedrawRequested()
def on_key_z_down(self, event): x = SharedObjects.getScale() SharedObjects.setScale( x+1 )
def on_key_x_down(self, event): x = SharedObjects.getScale() if x != 1: SharedObjects.setScale( x-1 )
if self.picked > len(self.maps) - 1: self.picked = 0 class ArtAssets(object): def __init__(self, path): self.assets = IS(path) #self.images = self.assets.spider() game = Game() # quitter just waits for quit events quitter = Quitter() ### Keyboard listener/controler # example of myKBD listener # esc key pushes a quit event kbdman = myKBD() SharedObjects.setFlushColor((255,255,255)) #SharedObjects.setFlushColor((0,0,0)) #filepath = string.join(game.paths.assets + ["maps", "test_pathfinding.tmx"], os.path.sep) filepath = game.paths.assets + os.path.sep + "maps" + os.path.sep + "test_pathfinding.tmx" ## reading map data tmap = ReadMap(filepath) mapobj = tmap.parse(game.paths.assets) ## actual tiler- attaches to event and render manager s = mapobj.map.properties['spawn_player_at'] scale = SharedObjects.getScale() #x = s[0] * mapobj.map.tilewidth * scale #y = s[1] * mapobj.map.tileheight * scale #mx = (mapobj.map.width * scale/2) #- x #my = (mapobj.map.height * scale/2) #- y tiler = tilemap.TMXTiler(mapobj, (game.res[0], game.res[1]),(0,0)) path = os.path.sep.join([game.paths.assets, 'tiles','_no_ownership' , 'oryx_lofi_1.2' ,'oryx_lofi_1.1',])