Open err0 opened 12 years ago
the problem I am trying to solve with this is that I have a tilemap of tree sprites. the player is centered on the full "ground" tilemap and I want to draw the sprites with y < player first, then the player, then the y > player sprites.
I think I'll try using TileMap.atRect next and simplify my viewports.
Pretty busy this weekend but i think we need to talk about this on irc ..not totally sure what you mean.. Im "ippa" on freenode
Here is what I ended up doing. It's working pretty well.
viewport.drawTileMap( tile_map_b ) //collision layer
viewport.drawTileMap( tile_map) // grass & ground
viewport_t.draw( tree_map.atRect(jaws.Rect(player.x - 250, player.y - 160, 500, 128 ))) //trees when above player on screen
viewport_t.draw( player ) //player centered on canvas
viewport_b.draw( tree_map.atRect(jaws.Rect(player.x - 250, player.y + 32, 500, 160 ))) //trees when below player on screen
I am still curious if there is a way to offset a viewport away from top left.
I can't seem to get a viewport to render only on the bottom part of the canvas. I can get it to render on only the top part just fine. canvas size is 500,320