Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. --Это некая карта из массива байт
  2. --0x0 используется как ничего, а 0x1 как стена
  3. local map = {
  4. { 0x1, 0x1, 0x1, 0x1 },
  5. { 0x1, nil, nil, 0x1 },
  6. { 0x1, nil, 0x1, 0x1 },
  7. { 0x1, 0x1, 0x1, 0x1 },
  8. }
  9.  
  10. local yMap, xMap = math.floor(player.y / 32), math.floor(player.x / 32)
  11.  
  12. if map[yMap] and map[yMap][xMap] then
  13. return map[yMap][xMap]
  14. end
  15.  
  16. if ((map[yMap] != 0x0) & (map[yMap][xMap] != 0x0))
  17.  
  18. public struct Coord { public int x, y; }
  19.  
  20.  
  21. Coord player;
  22. player.y = 32;
  23. player.x = 64;
  24.  
  25. int[,] map = {
  26. { 0x1, 0x1, 0x1, 0x1 },
  27. { 0x1, 0x0 , 0x0, 0x1 },
  28. { 0x1, 0x0 , 0x1, 0x1 },
  29. { 0x1, 0x1, 0x1, 0x1 },
  30. } ;
  31.  
  32. int yMap = (int)Math.Floor( (double) player.y / 32);
  33. int xMap = (int)Math.Floor( (double) player.x / 32);
  34. if ((map[yMap,xMap] != 0x1))
  35. Console.WriteLine("OK");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement