Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Это некая карта из массива байт
- --0x0 используется как ничего, а 0x1 как стена
- local map = {
- { 0x1, 0x1, 0x1, 0x1 },
- { 0x1, nil, nil, 0x1 },
- { 0x1, nil, 0x1, 0x1 },
- { 0x1, 0x1, 0x1, 0x1 },
- }
- local yMap, xMap = math.floor(player.y / 32), math.floor(player.x / 32)
- if map[yMap] and map[yMap][xMap] then
- return map[yMap][xMap]
- end
- if ((map[yMap] != 0x0) & (map[yMap][xMap] != 0x0))
- public struct Coord { public int x, y; }
- Coord player;
- player.y = 32;
- player.x = 64;
- int[,] map = {
- { 0x1, 0x1, 0x1, 0x1 },
- { 0x1, 0x0 , 0x0, 0x1 },
- { 0x1, 0x0 , 0x1, 0x1 },
- { 0x1, 0x1, 0x1, 0x1 },
- } ;
- int yMap = (int)Math.Floor( (double) player.y / 32);
- int xMap = (int)Math.Floor( (double) player.x / 32);
- if ((map[yMap,xMap] != 0x1))
- Console.WriteLine("OK");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement