Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. public static void drawMap(Canvas canvas, Player player, ArrayList<MapField> map)
  2. {
  3. int a = player.getShiftX()/Constants.TILE_SIZE;
  4. int b = player.getShiftY()/Constants.TILE_SIZE;
  5. for (int x = a-Constants.VISIBILITY_X; x<=a+Constants.VISIBILITY_X; x++)
  6. {
  7. if (x>=0&&x<=99)
  8. {
  9. for (int y = b-Constants.VISIBILITY_Y; y<=b+Constants.VISIBILITY_Y*2-1; y++)
  10. {
  11. if (y>=0&&y<=99)
  12. {
  13. map.get(x+y*100).update();
  14. map.get(x+y*100).draw(canvas);
  15. }
  16. }
  17. }
  18. }
  19. }
  20.  
  21. public void draw(Canvas canvas)
  22. {
  23. canvas.drawBitmap(Graphics.TILES_BITMAP[tileId], null, rect, p);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement