diff --git a/assets-cg/levels/level0.json b/assets-cg/levels/level0.json new file mode 100644 index 0000000..3f0baae --- /dev/null +++ b/assets-cg/levels/level0.json @@ -0,0 +1,44 @@ +{ "compressionlevel":-1, + "height":14, + "infinite":false, + "layers":[ + { + "data":[1, 1, 47, 1, 1, 1, 1, 1, 1, 1, 1, 47, 1, 1, 1, 3, 4, 1, 1, 1, 1, 3, 4, 1, 1, 1, 3, 0, 4, 1, 1, 1, 1, 1, 1, 3, 0, 4, 47, 50, 0, 0, 49, 47, 47, 50, 0, 0, 49, 1, 46, 0, 0, 0, 4, 1, 1, 1, 1, 46, 0, 0, 22, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 4, 46, 0, 0, 0, 0, 4, 1, 1, 1, 46, 0, 0, 22, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 14, 46, 0, 0, 0, 0, 0, 4, 1, 1, 46, 0, 0, 0, 39, 40, 0, 0, 39, 45, 45, 40, 0, 0, 39, 1, 46, 0, 0, 0, 0, 0, 0, 4, 1, 46, 0, 0, 0, 48, 1, 13, 14, 1, 1, 1, 1, 13, 14, 1, 1, 46, 0, 0, 0, 0, 0, 0, 0, 4, 50, 0, 0, 0, 48, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 46, 0, 0, 0, 39, 13, 0, 0, 0, 0, 0, 0, 0, 48, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 46, 0, 0, 0, 48, 1, 13, 0, 0, 0, 0, 0, 0, 48, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 46, 0, 0, 0, 48, 1, 1, 13, 0, 0, 0, 0, 0, 48, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 46, 0, 0, 0, 48, 1, 1, 1, 13, 0, 0, 0, 0, 48, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 46, 0, 0, 0, 48, 1, 1, 1, 1, 13, 0, 0, 0, 48, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, 0, 14, 1, 1, 1, 1, 1, 1, 13, 0, 14, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 45, 1, 1, 1, 1, 1, 1, 1, 1, 45, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + "height":14, + "id":1, + "name":"Background", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":25, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 23, 34, 0, 0, 0, 0, 0, 34, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 23, 34, 0, 0, 0, 0, 0, 34, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 32, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 0, 0, 0, 0, 0, 0, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":14, + "id":2, + "name":"Foreground", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":25, + "x":0, + "y":0 + }], + "nextlayerid":3, + "nextobjectid":1, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.8.0", + "tileheight":16, + "tilesets":[ + { + "firstgid":1, + "source":"tilesetnpp.tsx" + }], + "tilewidth":16, + "type":"map", + "version":"1.8", + "width":25 +} \ No newline at end of file diff --git a/assets-cg/levels/level1.json b/assets-cg/levels/level1.json new file mode 100644 index 0000000..1047665 --- /dev/null +++ b/assets-cg/levels/level1.json @@ -0,0 +1,44 @@ +{ "compressionlevel":-1, + "height":14, + "infinite":false, + "layers":[ + { + "data":[1, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 1, 29, 29, 29, 29, 29, 29, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 29, 29, 29, 29, 29, 29, 1, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 29, 29, 29, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 46, 0, 0, 20, 29, 29, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 29, 29, 9, 0, 0, 48, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 1, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1], + "height":14, + "id":1, + "name":"Background", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":25, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 44, 0, 0, 44, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":14, + "id":2, + "name":"Foreground", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":25, + "x":0, + "y":0 + }], + "nextlayerid":3, + "nextobjectid":1, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.8.0", + "tileheight":16, + "tilesets":[ + { + "firstgid":1, + "source":"tilesetnpp.tsx" + }], + "tilewidth":16, + "type":"map", + "version":"1.8", + "width":25 +} \ No newline at end of file diff --git a/assets-cg/levels/level2.json b/assets-cg/levels/level2.json new file mode 100644 index 0000000..fe084b7 --- /dev/null +++ b/assets-cg/levels/level2.json @@ -0,0 +1,44 @@ +{ "compressionlevel":-1, + "height":14, + "infinite":false, + "layers":[ + { + "data":[1, 1, 1, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 47, 47, 47, 1, 1, 1, 1, 1, 3, 0, 0, 0, 0, 4, 1, 1, 1, 1, 47, 1, 1, 1, 1, 3, 0, 0, 0, 0, 4, 1, 1, 1, 3, 0, 0, 0, 0, 0, 0, 4, 47, 5, 6, 0, 7, 8, 47, 3, 0, 0, 0, 0, 0, 0, 4, 1, 46, 0, 0, 14, 45, 45, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 45, 45, 13, 0, 0, 48, 46, 0, 0, 48, 1, 1, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 1, 1, 46, 0, 0, 48, 46, 0, 0, 48, 1, 1, 46, 0, 0, 0, 17, 18, 45, 15, 16, 0, 0, 0, 48, 1, 1, 46, 0, 0, 48, 46, 0, 0, 48, 1, 1, 46, 0, 0, 0, 48, 1, 47, 1, 46, 0, 0, 0, 48, 1, 1, 46, 0, 0, 48, 46, 0, 0, 48, 1, 1, 46, 0, 0, 0, 48, 3, 0, 4, 46, 0, 0, 0, 48, 1, 1, 46, 0, 0, 48, 46, 0, 0, 48, 1, 1, 1, 13, 0, 14, 46, 0, 0, 0, 48, 13, 0, 14, 1, 1, 1, 46, 0, 0, 48, 46, 0, 0, 48, 1, 1, 1, 1, 45, 1, 46, 0, 2, 0, 48, 1, 45, 1, 1, 1, 1, 46, 0, 0, 48, 46, 0, 0, 4, 47, 47, 47, 47, 47, 5, 6, 0, 0, 0, 7, 8, 47, 47, 47, 47, 47, 3, 0, 0, 48, 1, 13, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 14, 1, 1, 1, 13, 0, 21, 0, 0, 0, 0, 0, 17, 18, 45, 15, 16, 0, 0, 0, 0, 0, 21, 0, 14, 1, 1, 1, 1, 1, 45, 45, 45, 45, 45, 45, 45, 1, 1, 1, 1, 1, 45, 45, 45, 45, 45, 45, 45, 1, 1, 1], + "height":14, + "id":1, + "name":"Background", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":25, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 23, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 34, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 33, 0, 0, 0, 32, 0, 0, 0, 33, 0, 0, 0, 0, 0, 42, 0, 0, 0, 23, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":14, + "id":2, + "name":"Foreground", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":25, + "x":0, + "y":0 + }], + "nextlayerid":4, + "nextobjectid":3, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.8.0", + "tileheight":16, + "tilesets":[ + { + "firstgid":1, + "source":"tilesetnpp.tsx" + }], + "tilewidth":16, + "type":"map", + "version":"1.8", + "width":25 +} \ No newline at end of file diff --git a/assets-cg/levels/level3.json b/assets-cg/levels/level3.json new file mode 100644 index 0000000..9e9d44c --- /dev/null +++ b/assets-cg/levels/level3.json @@ -0,0 +1,44 @@ +{ "compressionlevel":-1, + "height":14, + "infinite":false, + "layers":[ + { + "data":[0, 0, 0, 0, 17, 18, 29, 29, 15, 16, 0, 0, 0, 0, 0, 17, 18, 29, 29, 15, 16, 0, 0, 0, 0, 0, 0, 0, 14, 5, 6, 22, 0, 7, 8, 15, 16, 0, 17, 18, 5, 6, 22, 0, 7, 8, 13, 0, 0, 0, 0, 0, 14, 3, 0, 0, 22, 0, 0, 0, 4, 1, 1, 1, 3, 0, 0, 22, 0, 0, 0, 4, 13, 0, 0, 0, 14, 3, 0, 0, 0, 22, 0, 0, 0, 0, 26, 1, 25, 0, 0, 0, 22, 0, 0, 0, 0, 4, 13, 0, 28, 25, 0, 0, 0, 0, 39, 40, 0, 0, 0, 36, 1, 35, 0, 0, 0, 39, 40, 0, 0, 0, 0, 26, 27, 38, 35, 0, 0, 17, 18, 1, 1, 27, 0, 0, 0, 19, 0, 0, 0, 28, 1, 1, 15, 16, 0, 0, 36, 37, 30, 0, 0, 14, 1, 1, 1, 1, 37, 0, 0, 0, 0, 0, 0, 0, 38, 1, 1, 1, 1, 13, 0, 0, 30, 30, 0, 0, 4, 1, 1, 1, 1, 1, 15, 16, 0, 0, 0, 17, 18, 1, 1, 1, 1, 1, 3, 0, 0, 30, 26, 27, 0, 0, 7, 8, 1, 1, 1, 1, 47, 29, 29, 29, 47, 1, 1, 1, 1, 5, 6, 0, 0, 28, 25, 36, 37, 0, 0, 0, 0, 4, 47, 5, 6, 0, 0, 0, 0, 0, 7, 8, 47, 3, 0, 0, 0, 0, 38, 35, 0, 4, 13, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 14, 3, 0, 0, 0, 4, 13, 0, 0, 0, 21, 0, 0, 14, 45, 29, 45, 13, 0, 0, 21, 0, 0, 0, 14, 3, 0, 0, 0, 0, 0, 4, 15, 16, 0, 21, 17, 18, 5, 6, 0, 7, 8, 15, 16, 21, 0, 17, 18, 3, 0, 0, 0, 0, 0, 0, 0, 7, 8, 29, 29, 5, 6, 0, 0, 0, 0, 0, 7, 8, 29, 29, 5, 6, 0, 0, 0, 0], + "height":14, + "id":1, + "name":"Background", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":25, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 42, 0, 0, 0, 42, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 42, 0, 0, 0, 42, 0, 0, 0, 0, 0, 42, 31, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":14, + "id":2, + "name":"Foreground", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":25, + "x":0, + "y":0 + }], + "nextlayerid":3, + "nextobjectid":1, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.8.0", + "tileheight":16, + "tilesets":[ + { + "firstgid":1, + "source":"tilesetnpp.tsx" + }], + "tilewidth":16, + "type":"map", + "version":"1.8", + "width":25 +} \ No newline at end of file diff --git a/assets-cg/levels/level4.json b/assets-cg/levels/level4.json new file mode 100644 index 0000000..3ec52f0 --- /dev/null +++ b/assets-cg/levels/level4.json @@ -0,0 +1,44 @@ +{ "compressionlevel":-1, + "height":14, + "infinite":false, + "layers":[ + { + "data":[1, 1, 1, 1, 1, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, 1, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 1, 1, 1, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 1, 1, 25, 0, 0, 0, 0, 0, 0, 0, 17, 18, 27, 0, 28, 15, 16, 0, 0, 0, 0, 0, 0, 0, 26, 1, 1, 35, 0, 0, 0, 0, 0, 0, 14, 1, 1, 37, 0, 38, 1, 1, 13, 0, 0, 0, 0, 0, 0, 36, 1, 46, 0, 0, 0, 0, 0, 0, 28, 1, 1, 5, 6, 0, 7, 8, 1, 1, 27, 0, 0, 0, 0, 0, 0, 48, 46, 0, 0, 0, 0, 0, 0, 38, 1, 25, 0, 0, 0, 0, 0, 26, 1, 37, 0, 0, 0, 0, 0, 0, 48, 46, 0, 0, 0, 0, 0, 0, 26, 1, 35, 0, 0, 0, 0, 0, 36, 1, 25, 0, 0, 0, 0, 0, 0, 48, 46, 0, 0, 0, 0, 0, 0, 36, 1, 13, 0, 0, 0, 0, 0, 14, 1, 35, 0, 0, 0, 0, 0, 0, 48, 1, 27, 0, 0, 0, 0, 0, 0, 4, 1, 13, 0, 0, 0, 14, 1, 3, 0, 0, 0, 0, 0, 0, 28, 1, 1, 37, 0, 0, 0, 0, 0, 0, 0, 7, 8, 29, 29, 29, 5, 6, 0, 0, 0, 0, 0, 0, 0, 38, 1, 1, 1, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 1, 1, 1, 1, 1, 15, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 18, 1, 1, 1, 1, 1, 1, 1, 1, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1, 1, 1, 1, 1], + "height":14, + "id":2, + "name":"Background", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":25, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 24, 0, 0, 31, 0, 0, 24, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 23, 0, 0, 42, 42, 42, 0, 0, 0, 43, 0, 0, 0, 43, 0, 0, 0, 42, 42, 42, 0, 0, 34, 0, 0, 0, 0, 0, 42, 42, 42, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":14, + "id":1, + "name":"Foreground", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":25, + "x":0, + "y":0 + }], + "nextlayerid":3, + "nextobjectid":1, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.8.0", + "tileheight":16, + "tilesets":[ + { + "firstgid":1, + "source":"tilesetnpp.tsx" + }], + "tilewidth":16, + "type":"map", + "version":"1.8", + "width":25 +} \ No newline at end of file diff --git a/assets-cg/levels/level5.json b/assets-cg/levels/level5.json new file mode 100644 index 0000000..86e921c --- /dev/null +++ b/assets-cg/levels/level5.json @@ -0,0 +1,44 @@ +{ "compressionlevel":-1, + "height":14, + "infinite":false, + "layers":[ + { + "data":[1, 1, 1, 1, 1, 47, 47, 1, 1, 1, 47, 47, 47, 47, 47, 1, 1, 1, 47, 47, 1, 1, 1, 1, 1, 1, 3, 4, 1, 46, 0, 0, 48, 1, 3, 0, 0, 0, 0, 0, 4, 1, 46, 0, 0, 48, 1, 3, 4, 1, 1, 13, 0, 4, 50, 0, 0, 49, 3, 0, 0, 0, 0, 0, 0, 0, 4, 50, 0, 0, 49, 3, 0, 14, 1, 1, 1, 13, 0, 0, 0, 0, 0, 0, 0, 0, 20, 45, 9, 0, 0, 0, 0, 0, 0, 0, 0, 14, 1, 1, 1, 47, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 47, 1, 46, 0, 0, 0, 0, 39, 40, 0, 0, 39, 13, 0, 0, 0, 14, 40, 0, 0, 39, 40, 0, 0, 0, 0, 48, 46, 0, 0, 0, 0, 49, 50, 0, 0, 4, 50, 0, 0, 0, 49, 3, 0, 0, 49, 50, 0, 0, 0, 0, 48, 1, 45, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 45, 1, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 1, 1, 3, 0, 14, 40, 0, 0, 39, 13, 0, 0, 0, 30, 0, 0, 0, 14, 40, 0, 0, 39, 13, 0, 4, 1, 1, 13, 14, 1, 46, 0, 0, 48, 46, 0, 0, 39, 1, 40, 0, 0, 48, 46, 0, 0, 48, 1, 13, 14, 1, 1, 1, 1, 1, 46, 0, 0, 48, 46, 0, 0, 4, 47, 3, 0, 0, 48, 46, 0, 0, 48, 1, 1, 1, 1, 1, 1, 1, 1, 1, 45, 45, 1, 1, 13, 0, 0, 0, 0, 0, 14, 1, 1, 45, 45, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 45, 45, 45, 45, 45, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + "height":14, + "id":1, + "name":"Background", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":25, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 34, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 23, 0, 0, 34, 0, 0, 23, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 0, 0, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":14, + "id":2, + "name":"Foreground", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":25, + "x":0, + "y":0 + }], + "nextlayerid":3, + "nextobjectid":1, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.8.0", + "tileheight":16, + "tilesets":[ + { + "firstgid":1, + "source":"tilesetnpp.tsx" + }], + "tilewidth":16, + "type":"map", + "version":"1.8", + "width":25 +} \ No newline at end of file diff --git a/assets-cg/levels/tilesetnpp.json b/assets-cg/levels/tilesetnpp.json new file mode 100644 index 0000000..9168519 --- /dev/null +++ b/assets-cg/levels/tilesetnpp.json @@ -0,0 +1,14 @@ +{ "columns":10, + "image":"tileset.png", + "imageheight":80, + "imagewidth":160, + "margin":0, + "name":"tileset", + "spacing":0, + "tilecount":50, + "tiledversion":"1.8.0", + "tileheight":16, + "tilewidth":16, + "type":"tileset", + "version":"1.8" +} \ No newline at end of file diff --git a/src/level.cpp b/src/level.cpp index 880c27d..22f707f 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -13,6 +13,8 @@ #include #include +#include "player.h" + #define TILESIZE 16 extern struct Map map_level0; @@ -22,6 +24,7 @@ extern struct Map map_level3; extern struct Map map_level4; extern struct Map map_level5; + extern bool drawbackground; extern bool drawforeground; extern bool drawnormals; @@ -33,7 +36,7 @@ extern bool textforetile; extern uint16_t tilecolor; extern std::vector MyLevelBorders; - +extern Player MyPlayer; struct Map *map_level; @@ -48,7 +51,7 @@ extern bopti_image_t img_selected; Level::Level( ) { map_level = &map_level0; - this->UpdateBorders(); + this->UpdateDataMap( ); } Level::~Level( ) @@ -56,7 +59,7 @@ Level::~Level( ) } -void Level::ChangeMap( int level, Player *MyPlayer ) +void Level::ChangeMap( int level ) { if(level==0) map_level = &map_level0; else if(level==1) map_level = &map_level1; @@ -66,11 +69,10 @@ void Level::ChangeMap( int level, Player *MyPlayer ) else if(level==5) map_level = &map_level5; else map_level = &map_level0; - this->UpdateDataMap( MyPlayer ); - this->UpdateBorders( ); + this->UpdateDataMap( ); } -void Level::UpdateDataMap( Player *MyPlayer ) +void Level::UpdateDataMap( void ) { for(int i=0; iw; i++) { @@ -80,13 +82,13 @@ void Level::UpdateDataMap( Player *MyPlayer ) uint16_t currentTile = map_level->layers[1][ index ]; if (currentTile==31) { - MyPlayer->currx = (float) (i) + 0.5f; - MyPlayer->curry = (float) (j) + 0.5f; + MyPlayer.currx = ((float) (i + 0.5f))*16.0f; + MyPlayer.curry = ((float) (j + 0.5f))*16.0f; - MyPlayer->vx = 0.0f; - MyPlayer->vy = 0.0f; + MyPlayer.vx = 0.0f; + MyPlayer.vy = 0.0f; - MyPlayer->Update( 0.0f ); + MyPlayer.Update( 0.0f ); } } } @@ -120,13 +122,13 @@ void Level::Render( void ) #if(DEBUG_MODE) if (drawborders) - for( int i=0; iA.x, (int) MyLevelBorders[i]->A.y, (int) MyLevelBorders[i]->B.x, (int) MyLevelBorders[i]->B.y, C_GREEN ); if (drawnormals) - for( int i=0; iA.x+(int) MyLevelBorders[i]->B.x)/2, ((int) MyLevelBorders[i]->A.y+(int) MyLevelBorders[i]->B.y)/2, ((int) MyLevelBorders[i]->A.x+(int) MyLevelBorders[i]->B.x)/2 + (int) MyLevelBorders[i]->N.x/2, ((int) MyLevelBorders[i]->A.y+(int) MyLevelBorders[i]->B.y)/2 + (int) MyLevelBorders[i]->N.y/2, C_BLUE ); @@ -144,7 +146,7 @@ void Level::RenderSelected( uint8_t i, uint8_t j ) void Level::Update( float dt ) { - + UpdateBorders( ); } /*RETURN the type of tile located in the background for the point x, y using player coordinates (x=[0..25], y=[0..14]) */ @@ -201,7 +203,7 @@ bool Level::CanGo( Player *MyPlayer ) /*TO DO : TO BE IMPROVED, THIS IS REALLY DIRTY !!!!*/ bool Level::IsOnGround( Player *MyPlayer ) { - if (this->GetTileBackgroundINT( (uint8_t) MyPlayer->currx, (uint8_t) MyPlayer->curry +1 ) !=0) + if (this->GetTileBackgroundINT( (int) MyPlayer->currx, (int) MyPlayer->curry +1 ) !=0) { return true; } @@ -225,265 +227,302 @@ Border* Level::MakeBorder( libnum::num DX, libnum::num DY, float x1, float y1, f return Bord; } -void Level::UpdateBorders( void ) -{ - MyLevelBorders.clear(); +void Level::ConvertTileToBorder( int16_t currentTile, libnum::num DeltaX, libnum::num DeltaY ) +{ Border *B1; - for(int i=0; iw; i++) + switch(currentTile) { - for(int j=0; jh; j++) + case -1: break; // Empty background + case 0: break; // No borders (filling tile) + + case 1: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,0.0, 0.0,1.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 0.0,1.0, 1.0,1.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 1.0,1.0, 1.0,0.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 1.0,0.0, 0.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + //45° diagonals + + case 2: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,1.0, 1.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 3: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,0.0, 1.0,1.0 ); + MyLevelBorders.push_back(B1); + break; + + case 12: + B1 = MakeBorder( DeltaX, DeltaY, 1.0,1.0, 0.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 13: + B1 = MakeBorder( DeltaX, DeltaY, 1.0,0.0, 0.0,1.0 ); + MyLevelBorders.push_back(B1); + break; + + + //22.5° diagonals + + case 4: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,1.0, 1.0,0.5 ); + MyLevelBorders.push_back(B1); + break; + + case 5: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,0.5, 1.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 6: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,0.0, 1.0,0.5 ); + MyLevelBorders.push_back(B1); + break; + + case 7: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,0.5, 1.0,1.0 ); + MyLevelBorders.push_back(B1); + break; + + + case 14: + B1 = MakeBorder( DeltaX, DeltaY, 1.0,0.5, 0.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 15: + B1 = MakeBorder( DeltaX, DeltaY, 1.0,1.0, 0.0,0.5 ); + MyLevelBorders.push_back(B1); + break; + + case 16: + B1 = MakeBorder( DeltaX, DeltaY, 1.0,0.5, 0.0,1.0 ); + MyLevelBorders.push_back(B1); + break; + + case 17: + B1 = MakeBorder( DeltaX, DeltaY, 1.0,0.0, 0.0,0.5 ); + MyLevelBorders.push_back(B1); + break; + + + + // 67.5° Diagonals + + + case 24: + B1 = MakeBorder( DeltaX, DeltaY, 0.5,1.0, 1.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 34: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,1.0, 0.5,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 25: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,0.0, 0.5,1.0 ); + MyLevelBorders.push_back(B1); + break; + + case 35: + B1 = MakeBorder( DeltaX, DeltaY, 0.5,0.0, 1.0,1.0 ); + MyLevelBorders.push_back(B1); + break; + + + case 26: + B1 = MakeBorder( DeltaX, DeltaY, 0.5,1.0, 0.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 36: + B1 = MakeBorder( DeltaX, DeltaY, 1.0,1.0, 0.5,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 27: + B1 = MakeBorder( DeltaX, DeltaY, 1.0,0.0, 0.5,1.0 ); + MyLevelBorders.push_back(B1); + break; + + case 37: + B1 = MakeBorder( DeltaX, DeltaY, 0.5,0.0, 0.0,1.0 ); + MyLevelBorders.push_back(B1); + break; + + + // Blocks with 3 sides + + case 8: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,1.0, 1.0,1.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 1.0,1.0, 1.0,0.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 1.0,0.0, 0.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 9: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,0.0, 0.0,1.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 1.0,1.0, 1.0,0.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 1.0,0.0, 0.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 18: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,0.0, 0.0,1.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 0.0,1.0, 1.0,1.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 1.0,1.0, 1.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 19: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,0.0, 0.0,1.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 0.0,1.0, 1.0,1.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 1.0,0.0, 0.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + // Blocks with 2 sides + + case 28: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,1.0, 1.0,1.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 1.0,0.0, 0.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 29: + + B1 = MakeBorder( DeltaX, DeltaY, 0.0,0.0, 0.0,1.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 1.0,1.0, 1.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 38: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,0.0, 0.0,1.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 1.0,0.0, 0.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 39: + B1 = MakeBorder( DeltaX, DeltaY, 1.0,1.0, 1.0,0.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 1.0,0.0, 0.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 48: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,0.0, 0.0,1.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 0.0,1.0, 1.0,1.0 ); + MyLevelBorders.push_back(B1); + break; + + case 49: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,1.0, 1.0,1.0 ); + MyLevelBorders.push_back(B1); + B1 = MakeBorder( DeltaX, DeltaY, 1.0,1.0, 1.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + // Blocks with one single side + + case 10: + case 44: + B1 = MakeBorder( DeltaX, DeltaY, 1.0,0.0, 0.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + case 11: + case 46: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,1.0, 1.0,1.0 ); + MyLevelBorders.push_back(B1); + break; + + case 20: + case 47: + B1 = MakeBorder( DeltaX, DeltaY, 0.0,0.0, 0.0,1.0 ); + MyLevelBorders.push_back(B1); + break; + + case 21: + case 45: + B1 = MakeBorder( DeltaX, DeltaY, 1.0,1.0, 1.0,0.0 ); + MyLevelBorders.push_back(B1); + break; + + default: + break; + } +} + + +#if 0 + +void Level::UpdateBorders( void ) +{ + for(unsigned int i=0; iw; i++) + { + for( int j=0; jh; j++) { uint16_t index = j * map_level->w + i; int16_t currentTile = map_level->layers[0][ index ]; libnum::num DeltaX = libnum::num( i*16 ); - libnum::num Deltay = libnum::num( j*16 ); + libnum::num DeltaY = libnum::num( j*16 ); - - switch(currentTile) - { - case -1: break; // Empty background - case 0: break; // No borders (filling tile) - - case 1: - B1 = MakeBorder( DeltaX, Deltay, 0.0,0.0, 0.0,1.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 0.0,1.0, 1.0,1.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 1.0,1.0, 1.0,0.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 1.0,0.0, 0.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - //45° diagonals - - case 2: - B1 = MakeBorder( DeltaX, Deltay, 0.0,1.0, 1.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 3: - B1 = MakeBorder( DeltaX, Deltay, 0.0,0.0, 1.0,1.0 ); - MyLevelBorders.push_back(B1); - break; - - case 12: - B1 = MakeBorder( DeltaX, Deltay, 1.0,1.0, 0.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 13: - B1 = MakeBorder( DeltaX, Deltay, 1.0,0.0, 0.0,1.0 ); - MyLevelBorders.push_back(B1); - break; - - - //22.5° diagonals - - case 4: - B1 = MakeBorder( DeltaX, Deltay, 0.0,1.0, 1.0,0.5 ); - MyLevelBorders.push_back(B1); - break; - - case 5: - B1 = MakeBorder( DeltaX, Deltay, 0.0,0.5, 1.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 6: - B1 = MakeBorder( DeltaX, Deltay, 0.0,0.0, 1.0,0.5 ); - MyLevelBorders.push_back(B1); - break; - - case 7: - B1 = MakeBorder( DeltaX, Deltay, 0.0,0.5, 1.0,1.0 ); - MyLevelBorders.push_back(B1); - break; - - - case 14: - B1 = MakeBorder( DeltaX, Deltay, 1.0,0.5, 0.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 15: - B1 = MakeBorder( DeltaX, Deltay, 1.0,1.0, 0.0,0.5 ); - MyLevelBorders.push_back(B1); - break; - - case 16: - B1 = MakeBorder( DeltaX, Deltay, 1.0,0.5, 0.0,1.0 ); - MyLevelBorders.push_back(B1); - break; - - case 17: - B1 = MakeBorder( DeltaX, Deltay, 1.0,0.0, 0.0,0.5 ); - MyLevelBorders.push_back(B1); - break; - - - - // 67.5° Diagonals - - - case 24: - B1 = MakeBorder( DeltaX, Deltay, 0.5,1.0, 1.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 34: - B1 = MakeBorder( DeltaX, Deltay, 0.0,1.0, 0.5,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 25: - B1 = MakeBorder( DeltaX, Deltay, 0.0,0.0, 0.5,1.0 ); - MyLevelBorders.push_back(B1); - break; - - case 35: - B1 = MakeBorder( DeltaX, Deltay, 0.5,0.0, 1.0,1.0 ); - MyLevelBorders.push_back(B1); - break; - - - case 26: - B1 = MakeBorder( DeltaX, Deltay, 0.5,1.0, 0.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 36: - B1 = MakeBorder( DeltaX, Deltay, 1.0,1.0, 0.5,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 27: - B1 = MakeBorder( DeltaX, Deltay, 1.0,0.0, 0.5,1.0 ); - MyLevelBorders.push_back(B1); - break; - - case 37: - B1 = MakeBorder( DeltaX, Deltay, 0.5,0.0, 0.0,1.0 ); - MyLevelBorders.push_back(B1); - break; - - - // Blocks with 3 sides - - case 8: - B1 = MakeBorder( DeltaX, Deltay, 0.0,1.0, 1.0,1.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 1.0,1.0, 1.0,0.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 1.0,0.0, 0.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 9: - B1 = MakeBorder( DeltaX, Deltay, 0.0,0.0, 0.0,1.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 1.0,1.0, 1.0,0.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 1.0,0.0, 0.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 18: - B1 = MakeBorder( DeltaX, Deltay, 0.0,0.0, 0.0,1.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 0.0,1.0, 1.0,1.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 1.0,1.0, 1.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 19: - B1 = MakeBorder( DeltaX, Deltay, 0.0,0.0, 0.0,1.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 0.0,1.0, 1.0,1.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 1.0,0.0, 0.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - // Blocks with 2 sides - - case 28: - B1 = MakeBorder( DeltaX, Deltay, 0.0,1.0, 1.0,1.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 1.0,0.0, 0.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 29: - - B1 = MakeBorder( DeltaX, Deltay, 0.0,0.0, 0.0,1.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 1.0,1.0, 1.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 38: - B1 = MakeBorder( DeltaX, Deltay, 0.0,0.0, 0.0,1.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 1.0,0.0, 0.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 39: - B1 = MakeBorder( DeltaX, Deltay, 1.0,1.0, 1.0,0.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 1.0,0.0, 0.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 48: - B1 = MakeBorder( DeltaX, Deltay, 0.0,0.0, 0.0,1.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 0.0,1.0, 1.0,1.0 ); - MyLevelBorders.push_back(B1); - break; - - case 49: - B1 = MakeBorder( DeltaX, Deltay, 0.0,1.0, 1.0,1.0 ); - MyLevelBorders.push_back(B1); - B1 = MakeBorder( DeltaX, Deltay, 1.0,1.0, 1.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - // Blocks with one single side - - case 10: - case 44: - B1 = MakeBorder( DeltaX, Deltay, 1.0,0.0, 0.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - case 11: - case 46: - B1 = MakeBorder( DeltaX, Deltay, 0.0,1.0, 1.0,1.0 ); - MyLevelBorders.push_back(B1); - break; - - case 20: - case 47: - B1 = MakeBorder( DeltaX, Deltay, 0.0,0.0, 0.0,1.0 ); - MyLevelBorders.push_back(B1); - break; - - case 21: - case 45: - B1 = MakeBorder( DeltaX, Deltay, 1.0,1.0, 1.0,0.0 ); - MyLevelBorders.push_back(B1); - break; - - default: - break; - } - + ConvertTileToBorder( currentTile, DeltaX, DeltaY ); } } -} \ No newline at end of file +} + +#else + +void Level::UpdateBorders( void ) +{ + for(unsigned int i=0; iw; i++) + { + for( int j=10; jh; j++) + { + uint16_t index = j * map_level->w + i; + int16_t currentTile = map_level->layers[0][ index ]; + + libnum::num DeltaX = libnum::num( i*16 ); + libnum::num DeltaY = libnum::num( j*16 ); + + ConvertTileToBorder( currentTile, DeltaX, DeltaY ); + } + } +} + +#endif \ No newline at end of file diff --git a/src/level.h b/src/level.h index ba3fb2c..bc7da96 100644 --- a/src/level.h +++ b/src/level.h @@ -36,9 +36,9 @@ class Level void Render( void ); void RenderSelected( uint8_t i, uint8_t j ); - void ChangeMap( int level, Player *MyPlayer ); - void UpdateDataMap( Player *MyPlayer ); - + void ChangeMap( int level ); + void UpdateDataMap( void ); + void ConvertTileToBorder( int16_t currentTile, libnum::num DeltaX, libnum::num DeltaY ); void UpdateBorders( void ); bool CanGo( Player *MyPlayer ); diff --git a/src/main.cpp b/src/main.cpp index 6f57b28..33e22d8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,7 +37,7 @@ bool record = false; bool textoutput = false; bool exitToOS = false; -uint8_t texttodraw=0; +uint8_t texttodraw=1; bool textbacktile = false; bool textforetile = false; @@ -108,6 +108,7 @@ static void hook_prefrag(int id, void *fragment, int size) static void update( float dt ) { MyPlayer.Update( dt ); + MyLevel.Update( dt ); } @@ -119,8 +120,9 @@ static void render( void ) // MyLevel.RenderSelected(); // MyPlayer.Render(); - #if(BIAS) - if (texttodraw>=1) azrp_draw_text(1,01, "FPS = %.0f", (float) (1000.0f / elapsedTime) ); + #if(BIAS) + if (texttodraw>=1) azrp_draw_text(1,01, "FPS = %.0f - Mem Free = %d", (float) (1000.0f / elapsedTime), _uram_stats->free_memory + extram_stats->free_memory ); + if (texttodraw==1) azrp_draw_text(1,11, "PlayX = %d - PlayY = %d", MyPlayer.tileX, MyPlayer.tileY ); if (texttodraw>=2) azrp_draw_text(1,31, "Update = %.3f ms", (float) time_update / 1000.0f ); if (texttodraw>=2) azrp_draw_text(1,41, "Render = %.3f ms", (float) time_render / 1000.0f ); @@ -157,24 +159,26 @@ static void get_inputs( float dt ) if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_4) ) { textbacktile = !textbacktile; } if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_5) ) { textforetile = !textforetile; } - if( MyKeyboard.IsKeyPressedEvent(MYKEY_F1) ) { MyLevel.ChangeMap(0, &MyPlayer); } - if( MyKeyboard.IsKeyPressedEvent(MYKEY_F2) ) { MyLevel.ChangeMap(1, &MyPlayer); } - if( MyKeyboard.IsKeyPressedEvent(MYKEY_F3) ) { MyLevel.ChangeMap(2, &MyPlayer); } - if( MyKeyboard.IsKeyPressedEvent(MYKEY_F4) ) { MyLevel.ChangeMap(3, &MyPlayer); } - if( MyKeyboard.IsKeyPressedEvent(MYKEY_F5) ) { MyLevel.ChangeMap(4, &MyPlayer); } - if( MyKeyboard.IsKeyPressedEvent(MYKEY_F6) ) { MyLevel.ChangeMap(5, &MyPlayer); } + if( MyKeyboard.IsKeyPressedEvent(MYKEY_F1) ) { MyLevel.ChangeMap( 0 ); } + if( MyKeyboard.IsKeyPressedEvent(MYKEY_F2) ) { MyLevel.ChangeMap( 1 ); } + if( MyKeyboard.IsKeyPressedEvent(MYKEY_F3) ) { MyLevel.ChangeMap( 2 ); } + if( MyKeyboard.IsKeyPressedEvent(MYKEY_F4) ) { MyLevel.ChangeMap( 3 ); } + if( MyKeyboard.IsKeyPressedEvent(MYKEY_F5) ) { MyLevel.ChangeMap( 4 ); } + if( MyKeyboard.IsKeyPressedEvent(MYKEY_F6) ) { MyLevel.ChangeMap( 5 ); } #endif /* we can have either LEFT or RIGHT or NONE OF THEM pressed for the direction */ if(MyKeyboard.IsKeyPressed(MYKEY_LEFT)) MyPlayer.Left( dt ); else if(MyKeyboard.IsKeyPressed(MYKEY_RIGHT)) MyPlayer.Right( dt ); + else if(MyKeyboard.IsKeyPressed(MYKEY_UP)) MyPlayer.Up( dt ); + else if(MyKeyboard.IsKeyPressed(MYKEY_DOWN)) MyPlayer.Down( dt ); else MyPlayer.Nothing( dt ); /* JUMP is */ if(MyKeyboard.IsKeyPressedEvent(MYKEY_SHIFT)) { - MyPlayer.Jump( dt ); + // MyPlayer.Jump( dt ); } } @@ -185,7 +189,7 @@ bool AddMoreRAM( void ) /* allow more RAM */ char const *osv = (char*) 0x80020020; - if((!strncmp(osv, "03.", 3) && osv[3] <= '6') && gint[HWCALC] == HWCALC_FXCG50) // CG-50 + if((!strncmp(osv, "03.", 3) && osv[3] <= '8') && gint[HWCALC] == HWCALC_FXCG50) // CG-50 { extended_ram.name = "extram"; extended_ram.is_default = true; @@ -289,11 +293,10 @@ int main(void) // all the stuff to be rendered should be put here azrp_clear( backcolor ); - render(); + render(); - azrp_draw_text(1,01, "FPS = %.0f", (float) (1000.0f / elapsedTime) ); - - azrp_circle( 198, 112, 40, C_RED ); + azrp_circle( (int) MyPlayer.currx, (int) MyPlayer.curry, 16, C_RED ); + azrp_circle( (int) MyPlayer.currx, (int) MyPlayer.curry, 17, C_RED ); azrp_update(); } diff --git a/src/player.cpp b/src/player.cpp index f429de3..3c8aaca 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -7,6 +7,10 @@ #include "level.h" #include "utilities.h" +#include + + + /* extern bopti_image_t img_walking; extern bopti_image_t img_running; @@ -21,26 +25,23 @@ extern Level MyLevel; #define SPEEDRUN 9.0f #define SPEEDJUMP 9.0f #define MAXFALLSPEED 15.0f - +#define MAXRUNSPEED 10.0f Player::Player( int16_t _x, int16_t _y ) { - this->currx = _x; // initial position - this->curry = _y; + this->currx = libnum::num(_x); // initial position + this->curry = libnum::num(_y); - this->vx = 0.0f; // initial velocity - this->vy = 0.0f; + this->vx = libnum::num(0.0f); // initial velocity + this->vy = libnum::num(0.0f); - this->ax = 0.0f; // initial acceleration (ie. gravity chosen at 1 unit - be careful of the sign, y axis oriented to the bottom ) - this->ay = 1.0f; + this->ax = libnum::num(0.0f); // initial acceleration (ie. gravity chosen at 1 unit - be careful of the sign, y axis oriented to the bottom ) + this->ay = libnum::num(0.0f); - this->width = 8; - this->height = 8; + this->tileX = (int) this->currx / 16; + this->tileY = (int) this->curry / 16; last_tick = rtc_ticks(); - - this->action = STATIC; - this->direction = STATIC; } @@ -51,22 +52,23 @@ Player::~Player() void Player::Update( float dt ) { - float DeltaTime = dt / 100.0f ; + libnum::num DeltaTime = libnum::num( dt / 100.0f ) ; this->vy += this->ay * DeltaTime; + this->vx += this->ax * DeltaTime; + if (this->vx >= MAXRUNSPEED) this->vx = MAXRUNSPEED; if (this->vy >= MAXFALLSPEED) this->vy = MAXFALLSPEED; - - - // we were jumping and are reaching the top of the curve or even starting falling - if (this->action == JUMP && this->vy >= 0) - { - this->action = FALL; - } - this->nextx = this->currx + this->vx * DeltaTime; this->nexty = this->curry + this->vy * DeltaTime; + this->currx = this->nextx; + this->curry = this->nexty; + + this->tileX = ((int) this->currx) / 16; + this->tileY = ((int) this->curry) / 16; + + MyLevel.UpdateBorders( ); } @@ -80,44 +82,41 @@ void Player::Render( void ) } azrp_image_p8_effect((int) (this->currx*16.0f), (int) (this->curry*16.0f), &img_circle, DIMAGE_NONE); - - #if(DEBUG_MODE) - if (this->action==STATIC) azrp_draw_text( (int) (this->currx*16.0f+4.0f), (int) (this->curry*16.0f+4.0f) , "S" ); - else if (this->action==DRAFT) azrp_draw_text( (int) (this->currx*16.0f+4.0f), (int) (this->curry*16.0f+4.0f) , "D" ); - else if (this->action==WALK) azrp_draw_text( (int) (this->currx*16.0f+4.0f), (int) (this->curry*16.0f+4.0f) , "W" ); - else if (this->action==RUN) azrp_draw_text( (int) (this->currx*16.0f+4.0f), (int) (this->curry*16.0f+4.0f) , "R" ); - else if (this->action==JUMP) azrp_draw_text( (int) (this->currx*16.0f+4.0f), (int) (this->curry*16.0f+4.0f) , "J" ); - else if (this->action==FALL) azrp_draw_text( (int) (this->currx*16.0f+4.0f), (int) (this->curry*16.0f+4.0f) , "F" ); - else azrp_draw_text( (int) (this->currx*16.0f+4.0f), (int) (this->curry*16.0f+4.0f) , "X" ); - #endif - } void Player::Left( float dt ) { this->vx += LEFT; - this->direction = LEFT; - this->action = RUN; } void Player::Right( float dt ) { this->vx += RIGHT; - this->direction = RIGHT; - this->action = RUN; +} + +void Player::Up( float dt ) +{ + this->vy += TOP; +} + + +void Player::Down( float dt ) +{ + this->vy += BOTTOM; } void Player::Jump( float dt ) { this->vy -= SPEEDJUMP; - this->action = JUMP; } void Player::Nothing( float dt ) { - this->vx *= 0.98; + this->vx *= libnum::num(0.95); + this->vy *= libnum::num(0.95); } + diff --git a/src/player.h b/src/player.h index 787bf7e..4ba11c5 100644 --- a/src/player.h +++ b/src/player.h @@ -19,12 +19,11 @@ enum FALL = 5, }; -enum -{ - LEFT = -1, - CENTER = 0, - RIGHT = 1, -}; +#define LEFT libnum::num(-1) +#define TOP libnum::num(-1) +#define CENTER libnum::num(0) +#define BOTTOM libnum::num(+1) +#define RIGHT libnum::num(+1) class Player @@ -38,26 +37,20 @@ class Player void Left( float dt ); void Right( float dt ); + void Up( float dt ); + void Down( float dt ); void Nothing( float dt ); void Jump( float dt ); - float currx, curry; // center position of the player - float nextx, nexty; // interim x and y position (to be tested to check if they can be actually achieved or not while moving) + libnum::num currx, curry; // center position of the player + libnum::num nextx, nexty; // interim x and y position (to be tested to check if they can be actually achieved or not while moving) + int8_t tileX, tileY; - float vx, vy; // speed of the player as per x and y coordinates - float ax, ay; // acceleration of the player as per x an y coordinates - - uint16_t xscreen, yscreen; - uint8_t width, height; // width and height - for the hitbox + libnum::num vx, vy; // speed of the player as per x and y coordinates + libnum::num ax, ay; // acceleration of the player as per x an y coordinates uint32_t last_tick; - - bool playeronground = true; - float currentspeed = 0.0f; - - int8_t direction = STATIC; - int8_t action = STATIC; }; diff --git a/src/utilities.cpp b/src/utilities.cpp index 7c0a510..d3ef723 100644 --- a/src/utilities.cpp +++ b/src/utilities.cpp @@ -25,3 +25,16 @@ void azrp_draw_text(int x, int y, char const *fmt, ...) azrp_subimage(x + 5 * i, y, &img_font, 7 * col + 1, 9 * row + 1, 6, 8, DIMAGE_NONE); } } + + +int min( int x, int y ) +{ + if (x<=y) return x; + else return y; +} + +int max( int x, int y ) +{ + if (x>=y) return x; + else return y; +} \ No newline at end of file diff --git a/src/utilities.h b/src/utilities.h index 66616ad..38e7713 100644 --- a/src/utilities.h +++ b/src/utilities.h @@ -3,6 +3,10 @@ void azrp_draw_text(int x, int y, char const *fmt, ...); +int min( int x, int y ); +int max( int x, int y ); + + #define ABS(a) ( ( (a) >= 0 ) ? (a) : -(a) ) #endif \ No newline at end of file diff --git a/src/vector2D.cpp b/src/vector2D.cpp index 42e596e..82295eb 100644 --- a/src/vector2D.cpp +++ b/src/vector2D.cpp @@ -203,4 +203,14 @@ Vector2D ComputeVectorRebound(Vector2D v,Vector2D N) v2.x = v.x -2*pscal*N.x; v2.y = v.y -2*pscal*N.y; return v2; +} + +Border::Border() +{ + +} + +Border::~Border() +{ + } \ No newline at end of file diff --git a/src/vector2D.h b/src/vector2D.h index 9beeb89..57327ce 100644 --- a/src/vector2D.h +++ b/src/vector2D.h @@ -7,15 +7,23 @@ libnum::num32 sqrt_num32(libnum::num32 v); -typedef struct +class Point2D { - libnum::num x, y; -} Point2D; + public: + Point2D() {}; + ~Point2D() {}; -typedef struct + libnum::num x, y; +}; + +class Circle { - libnum::num x,y,r; -} Circle; + public: + Circle() {}; + ~Circle() {}; + + libnum::num x,y,r; +}; @@ -25,86 +33,90 @@ class Vector2D public: - Vector2D(); - Vector2D( float x, float y ); - Vector2D( libnum::num32 x, libnum::num32 y ); - ~Vector2D(); + Vector2D(); + Vector2D( float x, float y ); + Vector2D( libnum::num32 x, libnum::num32 y ); + ~Vector2D(); - Vector2D Clone( void ); + Vector2D Clone( void ); - void AddVectors( Vector2D a, Vector2D b ); - void Add( Vector2D v, libnum::num32 scale ); - void SubtractVectors( Vector2D a, Vector2D b ); - void Subtract( Vector2D v, libnum::num32 scale ); + void AddVectors( Vector2D a, Vector2D b ); + void Add( Vector2D v, libnum::num32 scale ); + void SubtractVectors( Vector2D a, Vector2D b ); + void Subtract( Vector2D v, libnum::num32 scale ); - libnum::num32 Length( void ); - void Scale( libnum::num32 scale ); + libnum::num32 Length( void ); + void Scale( libnum::num32 scale ); - libnum::num32 Dot( Vector2D v ); - Vector2D Perp( void ); + libnum::num32 Dot( Vector2D v ); + Vector2D Perp( void ); - inline constexpr Vector2D &operator+=( Vector2D const &other ) - { - this->x += other.x; - this->y += other.y; - return *this; - } + inline constexpr Vector2D &operator+=( Vector2D const &other ) + { + this->x += other.x; + this->y += other.y; + return *this; + } - inline constexpr Vector2D &operator-=( Vector2D const &other ) - { - this->x -= other.x; - this->y -= other.y; - return *this; - } + inline constexpr Vector2D &operator-=( Vector2D const &other ) + { + this->x -= other.x; + this->y -= other.y; + return *this; + } - inline constexpr Vector2D &operator*=( float scale ) - { - this->x *= libnum::num32(scale); - this->y *= libnum::num32(scale); - return *this; - } + inline constexpr Vector2D &operator*=( float scale ) + { + this->x *= libnum::num32(scale); + this->y *= libnum::num32(scale); + return *this; + } - inline constexpr Vector2D &operator/=( float scale ) - { - this->x /= libnum::num32(scale); - this->y /= libnum::num32(scale); - return *this; - } + inline constexpr Vector2D &operator/=( float scale ) + { + this->x /= libnum::num32(scale); + this->y /= libnum::num32(scale); + return *this; + } - inline friend Vector2D operator*(float scale, Vector2D const &v) { - Vector2D r; - r.x = v.x * libnum::num32( scale ); - r.y = v.y * libnum::num32( scale ); - return r; - } + inline friend Vector2D operator*(float scale, Vector2D const &v) { + Vector2D r; + r.x = v.x * libnum::num32( scale ); + r.y = v.y * libnum::num32( scale ); + return r; + } - inline friend Vector2D operator*(Vector2D const &v, float scale) { - Vector2D r; - r.x = v.x * libnum::num32( scale ); - r.y = v.y * libnum::num32( scale ); - return r; - } + inline friend Vector2D operator*(Vector2D const &v, float scale) { + Vector2D r; + r.x = v.x * libnum::num32( scale ); + r.y = v.y * libnum::num32( scale ); + return r; + } - inline friend Vector2D operator/(Vector2D const &v, float scale) { - Vector2D r; - r.x = v.x / libnum::num32( scale ); - r.y = v.y / libnum::num32( scale ); - return r; - } + inline friend Vector2D operator/(Vector2D const &v, float scale) { + Vector2D r; + r.x = v.x / libnum::num32( scale ); + r.y = v.y / libnum::num32( scale ); + return r; + } - libnum::num32 x; - libnum::num32 y; + libnum::num32 x; + libnum::num32 y; }; -typedef struct +class Border { - Point2D A; - Point2D B; - Vector2D N; -} Border; + public: + Border(); + ~Border(); + + Point2D A; + Point2D B; + Vector2D N; +}; bool CollisionDroite(Point2D A,Point2D B, Circle C);