diff --git a/assets/img/map/cave.json b/assets/img/map/cave.json new file mode 100644 index 0000000..3fdba6c --- /dev/null +++ b/assets/img/map/cave.json @@ -0,0 +1 @@ +[{"x":95,"y":25,"width":190,"height":50},{"x":500,"y":30,"width":440,"height":60},{"x":90,"y":80,"width":180,"height":60},{"x":305,"y":70,"width":10,"height":20},{"x":525,"y":65,"width":390,"height":10},{"x":530,"y":75,"width":380,"height":10},{"x":385,"y":85,"width":10,"height":10},{"x":435,"y":85,"width":30,"height":10},{"x":470,"y":85,"width":20,"height":10},{"x":615,"y":85,"width":210,"height":10},{"x":190,"y":95,"width":20,"height":10},{"x":435,"y":95,"width":10,"height":10},{"x":475,"y":100,"width":10,"height":20},{"x":525,"y":100,"width":10,"height":20},{"x":640,"y":95,"width":160,"height":10},{"x":200,"y":105,"width":20,"height":10},{"x":500,"y":105,"width":20,"height":10},{"x":575,"y":105,"width":30,"height":10},{"x":660,"y":105,"width":120,"height":10},{"x":75,"y":170,"width":150,"height":120},{"x":175,"y":120,"width":10,"height":20},{"x":205,"y":115,"width":10,"height":10},{"x":495,"y":120,"width":10,"height":20},{"x":520,"y":115,"width":20,"height":10},{"x":585,"y":130,"width":10,"height":40},{"x":665,"y":115,"width":110,"height":10},{"x":155,"y":125,"width":10,"height":10},{"x":190,"y":125,"width":20,"height":10},{"x":505,"y":130,"width":10,"height":20},{"x":525,"y":125,"width":10,"height":10},{"x":660,"y":125,"width":120,"height":10},{"x":185,"y":135,"width":50,"height":10},{"x":520,"y":135,"width":20,"height":10},{"x":595,"y":135,"width":10,"height":10},{"x":665,"y":135,"width":110,"height":10},{"x":155,"y":145,"width":10,"height":10},{"x":220,"y":145,"width":20,"height":10},{"x":670,"y":145,"width":100,"height":10},{"x":155,"y":155,"width":10,"height":10},{"x":190,"y":155,"width":40,"height":10},{"x":225,"y":155,"width":10,"height":10},{"x":355,"y":160,"width":10,"height":20},{"x":645,"y":155,"width":150,"height":10},{"x":200,"y":165,"width":100,"height":10},{"x":565,"y":170,"width":10,"height":20},{"x":600,"y":175,"width":20,"height":30},{"x":670,"y":165,"width":100,"height":10},{"x":210,"y":175,"width":120,"height":10},{"x":345,"y":175,"width":50,"height":10},{"x":415,"y":175,"width":10,"height":10},{"x":575,"y":180,"width":10,"height":20},{"x":665,"y":175,"width":110,"height":10},{"x":285,"y":185,"width":270,"height":10},{"x":545,"y":185,"width":30,"height":10},{"x":665,"y":185,"width":110,"height":10},{"x":295,"y":195,"width":290,"height":10},{"x":525,"y":195,"width":10,"height":10},{"x":630,"y":195,"width":180,"height":10},{"x":305,"y":205,"width":310,"height":10},{"x":545,"y":210,"width":10,"height":20},{"x":640,"y":205,"width":160,"height":10},{"x":185,"y":215,"width":70,"height":10},{"x":355,"y":215,"width":230,"height":10},{"x":555,"y":215,"width":10,"height":10},{"x":645,"y":215,"width":150,"height":10},{"x":160,"y":225,"width":20,"height":10},{"x":270,"y":225,"width":20,"height":10},{"x":380,"y":225,"width":180,"height":10},{"x":660,"y":225,"width":120,"height":10},{"x":70,"y":255,"width":140,"height":50},{"x":410,"y":235,"width":120,"height":10},{"x":665,"y":240,"width":110,"height":20},{"x":385,"y":245,"width":70,"height":10},{"x":590,"y":255,"width":20,"height":30},{"x":390,"y":255,"width":20,"height":10},{"x":670,"y":260,"width":100,"height":20},{"x":605,"y":265,"width":10,"height":10},{"x":655,"y":295,"width":130,"height":50},{"x":65,"y":285,"width":130,"height":10},{"x":60,"y":295,"width":120,"height":10},{"x":55,"y":305,"width":110,"height":10},{"x":410,"y":315,"width":20,"height":30},{"x":50,"y":365,"width":100,"height":110},{"x":510,"y":320,"width":40,"height":20},{"x":355,"y":325,"width":10,"height":10},{"x":650,"y":330,"width":140,"height":20},{"x":285,"y":335,"width":30,"height":10},{"x":380,"y":335,"width":100,"height":10},{"x":515,"y":350,"width":70,"height":40},{"x":340,"y":345,"width":160,"height":10},{"x":635,"y":345,"width":170,"height":10},{"x":335,"y":355,"width":170,"height":10},{"x":635,"y":355,"width":170,"height":10},{"x":330,"y":365,"width":180,"height":10},{"x":560,"y":370,"width":20,"height":20},{"x":650,"y":370,"width":140,"height":20},{"x":325,"y":375,"width":190,"height":10},{"x":485,"y":375,"width":10,"height":10},{"x":520,"y":375,"width":40,"height":10},{"x":285,"y":385,"width":110,"height":10},{"x":395,"y":385,"width":10,"height":10},{"x":515,"y":385,"width":10,"height":10},{"x":660,"y":395,"width":120,"height":30},{"x":105,"y":395,"width":10,"height":10},{"x":285,"y":400,"width":130,"height":20},{"x":580,"y":405,"width":20,"height":30},{"x":525,"y":405,"width":10,"height":10},{"x":170,"y":430,"width":20,"height":40},{"x":295,"y":425,"width":130,"height":30},{"x":520,"y":415,"width":20,"height":10},{"x":655,"y":415,"width":130,"height":10},{"x":45,"y":625,"width":90,"height":410},{"x":505,"y":425,"width":30,"height":10},{"x":650,"y":430,"width":140,"height":20},{"x":185,"y":435,"width":10,"height":10},{"x":375,"y":435,"width":30,"height":10},{"x":430,"y":435,"width":40,"height":10},{"x":495,"y":450,"width":10,"height":40},{"x":185,"y":445,"width":10,"height":10},{"x":245,"y":455,"width":30,"height":30},{"x":360,"y":445,"width":180,"height":10},{"x":530,"y":445,"width":20,"height":10},{"x":665,"y":445,"width":110,"height":10},{"x":180,"y":485,"width":20,"height":70},{"x":215,"y":460,"width":10,"height":20},{"x":305,"y":455,"width":90,"height":10},{"x":420,"y":455,"width":80,"height":10},{"x":535,"y":460,"width":10,"height":20},{"x":660,"y":465,"width":120,"height":30},{"x":305,"y":465,"width":90,"height":10},{"x":365,"y":470,"width":10,"height":20},{"x":385,"y":465,"width":10,"height":10},{"x":440,"y":470,"width":40,"height":20},{"x":505,"y":475,"width":10,"height":30},{"x":260,"y":475,"width":80,"height":10},{"x":330,"y":475,"width":40,"height":10},{"x":380,"y":475,"width":20,"height":10},{"x":520,"y":475,"width":20,"height":10},{"x":265,"y":485,"width":70,"height":10},{"x":315,"y":495,"width":10,"height":30},{"x":435,"y":485,"width":30,"height":10},{"x":515,"y":485,"width":10,"height":10},{"x":650,"y":485,"width":140,"height":10},{"x":265,"y":495,"width":50,"height":10},{"x":640,"y":505,"width":160,"height":30},{"x":195,"y":505,"width":10,"height":10},{"x":280,"y":510,"width":20,"height":20},{"x":195,"y":515,"width":10,"height":10},{"x":190,"y":535,"width":20,"height":30},{"x":580,"y":525,"width":20,"height":10},{"x":660,"y":535,"width":120,"height":30},{"x":575,"y":535,"width":10,"height":10},{"x":185,"y":555,"width":30,"height":10},{"x":320,"y":570,"width":20,"height":40},{"x":430,"y":565,"width":20,"height":30},{"x":650,"y":555,"width":140,"height":10},{"x":180,"y":580,"width":20,"height":40},{"x":450,"y":565,"width":20,"height":10},{"x":645,"y":565,"width":150,"height":10},{"x":95,"y":575,"width":10,"height":10},{"x":285,"y":580,"width":30,"height":20},{"x":335,"y":575,"width":10,"height":10},{"x":450,"y":575,"width":20,"height":10},{"x":660,"y":595,"width":120,"height":50},{"x":100,"y":585,"width":20,"height":10},{"x":195,"y":585,"width":10,"height":10},{"x":240,"y":595,"width":20,"height":30},{"x":335,"y":585,"width":10,"height":10},{"x":445,"y":585,"width":30,"height":10},{"x":100,"y":595,"width":20,"height":10},{"x":195,"y":595,"width":10,"height":10},{"x":340,"y":595,"width":40,"height":10},{"x":430,"y":600,"width":20,"height":20},{"x":100,"y":605,"width":20,"height":10},{"x":350,"y":605,"width":20,"height":10},{"x":340,"y":630,"width":20,"height":20},{"x":665,"y":630,"width":110,"height":20},{"x":280,"y":655,"width":20,"height":50},{"x":400,"y":645,"width":20,"height":30},{"x":430,"y":635,"width":20,"height":10},{"x":540,"y":650,"width":20,"height":40},{"x":430,"y":645,"width":40,"height":10},{"x":670,"y":650,"width":100,"height":20},{"x":310,"y":655,"width":40,"height":10},{"x":435,"y":655,"width":50,"height":10},{"x":375,"y":665,"width":170,"height":10},{"x":665,"y":675,"width":110,"height":30},{"x":350,"y":675,"width":100,"height":10},{"x":440,"y":675,"width":40,"height":10},{"x":310,"y":685,"width":20,"height":10},{"x":550,"y":685,"width":20,"height":10},{"x":545,"y":700,"width":30,"height":20},{"x":660,"y":700,"width":120,"height":20},{"x":205,"y":710,"width":10,"height":20},{"x":220,"y":715,"width":20,"height":10},{"x":270,"y":715,"width":20,"height":10},{"x":540,"y":715,"width":20,"height":10},{"x":655,"y":735,"width":130,"height":50},{"x":200,"y":725,"width":60,"height":10},{"x":260,"y":725,"width":20,"height":10},{"x":195,"y":735,"width":150,"height":10},{"x":205,"y":760,"width":190,"height":40},{"x":335,"y":745,"width":10,"height":10},{"x":320,"y":755,"width":40,"height":10},{"x":95,"y":765,"width":10,"height":10},{"x":320,"y":765,"width":40,"height":10},{"x":650,"y":765,"width":140,"height":10},{"x":95,"y":775,"width":10,"height":10},{"x":330,"y":775,"width":60,"height":10},{"x":470,"y":810,"width":20,"height":80},{"x":545,"y":830,"width":10,"height":120},{"x":655,"y":820,"width":130,"height":100},{"x":95,"y":785,"width":10,"height":10},{"x":125,"y":785,"width":30,"height":10},{"x":185,"y":790,"width":10,"height":20},{"x":310,"y":785,"width":100,"height":10},{"x":485,"y":785,"width":10,"height":10},{"x":95,"y":795,"width":10,"height":10},{"x":125,"y":800,"width":10,"height":20},{"x":320,"y":795,"width":80,"height":10},{"x":485,"y":795,"width":10,"height":10},{"x":95,"y":805,"width":10,"height":10},{"x":330,"y":805,"width":60,"height":10},{"x":495,"y":805,"width":30,"height":10},{"x":95,"y":815,"width":10,"height":10},{"x":340,"y":830,"width":40,"height":40},{"x":495,"y":815,"width":30,"height":10},{"x":365,"y":825,"width":10,"height":10},{"x":495,"y":825,"width":30,"height":10},{"x":40,"y":980,"width":80,"height":300},{"x":380,"y":835,"width":40,"height":10},{"x":495,"y":835,"width":30,"height":10},{"x":385,"y":845,"width":50,"height":10},{"x":495,"y":845,"width":30,"height":10},{"x":360,"y":855,"width":100,"height":10},{"x":480,"y":855,"width":20,"height":10},{"x":350,"y":865,"width":120,"height":10},{"x":475,"y":870,"width":10,"height":20},{"x":90,"y":875,"width":20,"height":10},{"x":345,"y":875,"width":130,"height":10},{"x":660,"y":895,"width":120,"height":50},{"x":90,"y":885,"width":20,"height":10},{"x":320,"y":885,"width":120,"height":10},{"x":90,"y":895,"width":20,"height":10},{"x":265,"y":900,"width":10,"height":20},{"x":330,"y":895,"width":100,"height":10},{"x":540,"y":895,"width":20,"height":10},{"x":575,"y":905,"width":10,"height":30},{"x":90,"y":905,"width":20,"height":10},{"x":325,"y":905,"width":110,"height":10},{"x":510,"y":905,"width":60,"height":10},{"x":90,"y":915,"width":20,"height":10},{"x":320,"y":915,"width":100,"height":10},{"x":480,"y":915,"width":20,"height":10},{"x":90,"y":925,"width":20,"height":10},{"x":305,"y":925,"width":110,"height":10},{"x":470,"y":925,"width":20,"height":10},{"x":530,"y":925,"width":40,"height":10},{"x":570,"y":925,"width":20,"height":10},{"x":655,"y":1005,"width":130,"height":170},{"x":90,"y":935,"width":20,"height":10},{"x":295,"y":940,"width":110,"height":20},{"x":460,"y":935,"width":20,"height":10},{"x":505,"y":935,"width":30,"height":10},{"x":565,"y":935,"width":10,"height":10},{"x":90,"y":945,"width":20,"height":10},{"x":450,"y":945,"width":20,"height":10},{"x":560,"y":945,"width":20,"height":10},{"x":90,"y":955,"width":20,"height":10},{"x":255,"y":960,"width":50,"height":20},{"x":325,"y":955,"width":50,"height":10},{"x":400,"y":955,"width":20,"height":10},{"x":445,"y":955,"width":10,"height":10},{"x":555,"y":955,"width":10,"height":10},{"x":90,"y":965,"width":20,"height":10},{"x":330,"y":965,"width":40,"height":10},{"x":390,"y":965,"width":20,"height":10},{"x":435,"y":965,"width":10,"height":10},{"x":550,"y":965,"width":20,"height":10},{"x":90,"y":975,"width":20,"height":10},{"x":250,"y":980,"width":60,"height":20},{"x":295,"y":975,"width":10,"height":10},{"x":340,"y":980,"width":20,"height":20},{"x":385,"y":985,"width":10,"height":30},{"x":540,"y":975,"width":20,"height":10},{"x":100,"y":985,"width":40,"height":10},{"x":305,"y":990,"width":10,"height":20},{"x":470,"y":985,"width":20,"height":10},{"x":525,"y":985,"width":30,"height":10},{"x":105,"y":995,"width":50,"height":10},{"x":250,"y":995,"width":80,"height":10},{"x":330,"y":995,"width":40,"height":10},{"x":445,"y":1000,"width":10,"height":20},{"x":465,"y":1040,"width":10,"height":100},{"x":515,"y":995,"width":10,"height":10},{"x":105,"y":1005,"width":50,"height":10},{"x":270,"y":1005,"width":160,"height":10},{"x":395,"y":1010,"width":10,"height":20},{"x":510,"y":1005,"width":20,"height":10},{"x":125,"y":1015,"width":90,"height":10},{"x":240,"y":1015,"width":80,"height":10},{"x":315,"y":1020,"width":50,"height":20},{"x":405,"y":1045,"width":10,"height":70},{"x":440,"y":1015,"width":20,"height":10},{"x":505,"y":1015,"width":10,"height":10},{"x":125,"y":1025,"width":90,"height":10},{"x":230,"y":1025,"width":60,"height":10},{"x":435,"y":1055,"width":10,"height":70},{"x":555,"y":1055,"width":10,"height":70},{"x":130,"y":1035,"width":100,"height":10},{"x":235,"y":1035,"width":50,"height":10},{"x":305,"y":1035,"width":50,"height":10},{"x":385,"y":1035,"width":10,"height":10},{"x":130,"y":1045,"width":100,"height":10},{"x":235,"y":1050,"width":30,"height":20},{"x":290,"y":1045,"width":60,"height":10},{"x":380,"y":1045,"width":20,"height":10},{"x":135,"y":1055,"width":110,"height":10},{"x":280,"y":1055,"width":60,"height":10},{"x":370,"y":1055,"width":20,"height":10},{"x":135,"y":1065,"width":110,"height":10},{"x":265,"y":1065,"width":70,"height":10},{"x":365,"y":1065,"width":10,"height":10},{"x":140,"y":1075,"width":120,"height":10},{"x":260,"y":1075,"width":60,"height":10},{"x":360,"y":1075,"width":20,"height":10},{"x":145,"y":1085,"width":130,"height":10},{"x":255,"y":1085,"width":50,"height":10},{"x":355,"y":1090,"width":10,"height":20},{"x":400,"y":1085,"width":20,"height":10},{"x":145,"y":1095,"width":130,"height":10},{"x":255,"y":1095,"width":30,"height":10},{"x":425,"y":1100,"width":10,"height":20},{"x":455,"y":1095,"width":10,"height":10},{"x":550,"y":1095,"width":20,"height":10},{"x":660,"y":1100,"width":120,"height":20},{"x":145,"y":1105,"width":130,"height":10},{"x":350,"y":1105,"width":20,"height":10},{"x":545,"y":1105,"width":10,"height":10},{"x":150,"y":1115,"width":140,"height":10},{"x":345,"y":1115,"width":10,"height":10},{"x":420,"y":1115,"width":20,"height":10},{"x":540,"y":1115,"width":20,"height":10},{"x":665,"y":1120,"width":110,"height":20},{"x":105,"y":1125,"width":50,"height":10},{"x":145,"y":1130,"width":10,"height":20},{"x":415,"y":1125,"width":10,"height":10},{"x":535,"y":1125,"width":10,"height":10},{"x":35,"y":1355,"width":70,"height":450},{"x":530,"y":1135,"width":20,"height":10},{"x":660,"y":1145,"width":120,"height":30},{"x":280,"y":1145,"width":20,"height":10},{"x":525,"y":1145,"width":10,"height":10},{"x":280,"y":1155,"width":40,"height":10},{"x":75,"y":1165,"width":10,"height":10},{"x":275,"y":1170,"width":30,"height":20},{"x":655,"y":1175,"width":130,"height":30},{"x":75,"y":1175,"width":10,"height":10},{"x":295,"y":1175,"width":10,"height":10},{"x":80,"y":1185,"width":20,"height":10},{"x":275,"y":1185,"width":50,"height":10},{"x":80,"y":1195,"width":20,"height":10},{"x":265,"y":1195,"width":50,"height":10},{"x":650,"y":1210,"width":140,"height":40},{"x":80,"y":1205,"width":20,"height":10},{"x":255,"y":1215,"width":70,"height":30},{"x":80,"y":1215,"width":20,"height":10},{"x":490,"y":1215,"width":20,"height":10},{"x":80,"y":1225,"width":20,"height":10},{"x":480,"y":1235,"width":40,"height":30},{"x":535,"y":1225,"width":10,"height":10},{"x":80,"y":1235,"width":20,"height":10},{"x":250,"y":1235,"width":60,"height":10},{"x":535,"y":1255,"width":30,"height":50},{"x":655,"y":1250,"width":130,"height":40},{"x":80,"y":1245,"width":20,"height":10},{"x":235,"y":1245,"width":70,"height":10},{"x":80,"y":1255,"width":20,"height":10},{"x":225,"y":1255,"width":70,"height":10},{"x":475,"y":1280,"width":30,"height":60},{"x":505,"y":1270,"width":10,"height":40},{"x":80,"y":1265,"width":20,"height":10},{"x":220,"y":1265,"width":60,"height":10},{"x":435,"y":1265,"width":30,"height":10},{"x":555,"y":1265,"width":10,"height":10},{"x":80,"y":1275,"width":20,"height":10},{"x":210,"y":1275,"width":60,"height":10},{"x":300,"y":1275,"width":20,"height":10},{"x":415,"y":1285,"width":70,"height":30},{"x":555,"y":1275,"width":10,"height":10},{"x":645,"y":1275,"width":150,"height":10},{"x":80,"y":1285,"width":20,"height":10},{"x":205,"y":1285,"width":70,"height":10},{"x":295,"y":1285,"width":30,"height":10},{"x":545,"y":1305,"width":30,"height":50},{"x":655,"y":1295,"width":130,"height":30},{"x":80,"y":1295,"width":20,"height":10},{"x":175,"y":1295,"width":10,"height":10},{"x":210,"y":1295,"width":40,"height":10},{"x":290,"y":1300,"width":40,"height":20},{"x":500,"y":1295,"width":20,"height":10},{"x":80,"y":1305,"width":20,"height":10},{"x":190,"y":1305,"width":80,"height":10},{"x":435,"y":1305,"width":30,"height":10},{"x":500,"y":1305,"width":20,"height":10},{"x":80,"y":1315,"width":20,"height":10},{"x":185,"y":1315,"width":70,"height":10},{"x":285,"y":1320,"width":50,"height":20},{"x":490,"y":1315,"width":40,"height":10},{"x":660,"y":1320,"width":120,"height":20},{"x":80,"y":1325,"width":20,"height":10},{"x":175,"y":1325,"width":70,"height":10},{"x":485,"y":1345,"width":30,"height":50},{"x":80,"y":1335,"width":20,"height":10},{"x":170,"y":1335,"width":60,"height":10},{"x":280,"y":1345,"width":80,"height":30},{"x":655,"y":1335,"width":130,"height":10},{"x":80,"y":1345,"width":20,"height":10},{"x":165,"y":1345,"width":50,"height":10},{"x":395,"y":1360,"width":30,"height":40},{"x":525,"y":1350,"width":10,"height":20},{"x":650,"y":1355,"width":140,"height":30},{"x":75,"y":1355,"width":10,"height":10},{"x":160,"y":1355,"width":40,"height":10},{"x":540,"y":1355,"width":20,"height":10},{"x":75,"y":1365,"width":10,"height":10},{"x":165,"y":1365,"width":30,"height":10},{"x":260,"y":1365,"width":60,"height":10},{"x":415,"y":1365,"width":10,"height":10},{"x":535,"y":1365,"width":70,"height":10},{"x":75,"y":1375,"width":10,"height":10},{"x":255,"y":1380,"width":70,"height":20},{"x":415,"y":1375,"width":10,"height":10},{"x":585,"y":1375,"width":270,"height":10},{"x":75,"y":1385,"width":10,"height":10},{"x":405,"y":1395,"width":30,"height":30},{"x":580,"y":1385,"width":280,"height":10},{"x":75,"y":1395,"width":10,"height":10},{"x":245,"y":1395,"width":90,"height":10},{"x":570,"y":1395,"width":300,"height":10},{"x":75,"y":1405,"width":10,"height":10},{"x":250,"y":1425,"width":80,"height":50},{"x":570,"y":1405,"width":300,"height":10},{"x":75,"y":1415,"width":10,"height":10},{"x":295,"y":1415,"width":10,"height":10},{"x":335,"y":1420,"width":10,"height":20},{"x":560,"y":1470,"width":320,"height":120},{"x":75,"y":1425,"width":10,"height":10},{"x":305,"y":1425,"width":30,"height":10},{"x":365,"y":1425,"width":10,"height":10},{"x":75,"y":1435,"width":10,"height":10},{"x":340,"y":1435,"width":100,"height":10},{"x":75,"y":1445,"width":10,"height":10},{"x":340,"y":1445,"width":100,"height":10},{"x":75,"y":1455,"width":10,"height":10},{"x":305,"y":1465,"width":170,"height":30},{"x":110,"y":1465,"width":80,"height":10},{"x":110,"y":1475,"width":80,"height":10},{"x":110,"y":1485,"width":80,"height":10},{"x":240,"y":1485,"width":40,"height":10},{"x":330,"y":1485,"width":120,"height":10},{"x":115,"y":1495,"width":90,"height":10},{"x":245,"y":1495,"width":30,"height":10},{"x":335,"y":1495,"width":110,"height":10},{"x":115,"y":1505,"width":90,"height":10},{"x":250,"y":1505,"width":20,"height":10},{"x":345,"y":1505,"width":90,"height":10},{"x":115,"y":1515,"width":90,"height":10},{"x":350,"y":1515,"width":40,"height":10},{"x":115,"y":1525,"width":90,"height":10},{"x":360,"y":1525,"width":40,"height":10},{"x":80,"y":1535,"width":20,"height":10},{"x":135,"y":1535,"width":70,"height":10},{"x":350,"y":1535,"width":20,"height":10},{"x":565,"y":1545,"width":310,"height":30},{"x":80,"y":1545,"width":20,"height":10},{"x":145,"y":1545,"width":50,"height":10},{"x":345,"y":1545,"width":10,"height":10},{"x":75,"y":1555,"width":10,"height":10},{"x":160,"y":1555,"width":40,"height":10},{"x":75,"y":1565,"width":10,"height":10},{"x":495,"y":1565,"width":130,"height":10},{"x":650,"y":1575,"width":140,"height":30},{"x":75,"y":1575,"width":10,"height":10},{"x":495,"y":1575,"width":110,"height":10},{"x":25,"y":1870,"width":50,"height":580},{"x":510,"y":1590,"width":20,"height":20},{"x":55,"y":1595,"width":10,"height":10},{"x":660,"y":1620,"width":120,"height":60},{"x":55,"y":1605,"width":10,"height":10},{"x":505,"y":1605,"width":10,"height":10},{"x":55,"y":1615,"width":10,"height":10},{"x":60,"y":1625,"width":20,"height":10},{"x":65,"y":1635,"width":30,"height":10},{"x":65,"y":1645,"width":30,"height":10},{"x":275,"y":1645,"width":30,"height":10},{"x":65,"y":1655,"width":30,"height":10},{"x":270,"y":1655,"width":40,"height":10},{"x":655,"y":1710,"width":130,"height":120},{"x":65,"y":1665,"width":30,"height":10},{"x":260,"y":1680,"width":60,"height":40},{"x":65,"y":1675,"width":30,"height":10},{"x":300,"y":1675,"width":20,"height":10},{"x":65,"y":1685,"width":30,"height":10},{"x":310,"y":1690,"width":20,"height":20},{"x":65,"y":1695,"width":30,"height":10},{"x":70,"y":1705,"width":40,"height":10},{"x":265,"y":1705,"width":90,"height":10},{"x":405,"y":1705,"width":10,"height":10},{"x":70,"y":1715,"width":40,"height":10},{"x":245,"y":1725,"width":90,"height":30},{"x":410,"y":1715,"width":40,"height":10},{"x":445,"y":1715,"width":10,"height":10},{"x":70,"y":1725,"width":40,"height":10},{"x":405,"y":1725,"width":90,"height":10},{"x":70,"y":1735,"width":40,"height":10},{"x":395,"y":1735,"width":110,"height":10},{"x":70,"y":1745,"width":40,"height":10},{"x":235,"y":1745,"width":110,"height":10},{"x":390,"y":1745,"width":120,"height":10},{"x":70,"y":1755,"width":40,"height":10},{"x":225,"y":1760,"width":110,"height":20},{"x":395,"y":1760,"width":150,"height":20},{"x":75,"y":1765,"width":50,"height":10},{"x":75,"y":1775,"width":50,"height":10},{"x":205,"y":1775,"width":110,"height":10},{"x":385,"y":1775,"width":130,"height":10},{"x":660,"y":1785,"width":120,"height":30},{"x":75,"y":1785,"width":50,"height":10},{"x":200,"y":1785,"width":120,"height":10},{"x":370,"y":1790,"width":100,"height":20},{"x":75,"y":1795,"width":50,"height":10},{"x":190,"y":1800,"width":100,"height":20},{"x":75,"y":1805,"width":50,"height":10},{"x":355,"y":1805,"width":70,"height":10},{"x":405,"y":1815,"width":10,"height":30},{"x":665,"y":1840,"width":110,"height":80},{"x":75,"y":1815,"width":50,"height":10},{"x":180,"y":1820,"width":80,"height":20},{"x":340,"y":1815,"width":100,"height":10},{"x":530,"y":1815,"width":20,"height":10},{"x":75,"y":1825,"width":50,"height":10},{"x":330,"y":1825,"width":120,"height":10},{"x":535,"y":1835,"width":10,"height":30},{"x":75,"y":1835,"width":50,"height":10},{"x":170,"y":1840,"width":60,"height":20},{"x":315,"y":1835,"width":130,"height":10},{"x":395,"y":1835,"width":10,"height":10},{"x":475,"y":1835,"width":10,"height":10},{"x":75,"y":1845,"width":50,"height":10},{"x":300,"y":1845,"width":160,"height":10},{"x":500,"y":1845,"width":40,"height":10},{"x":70,"y":1855,"width":40,"height":10},{"x":295,"y":1860,"width":170,"height":20},{"x":485,"y":1885,"width":10,"height":70},{"x":525,"y":1855,"width":30,"height":10},{"x":65,"y":1865,"width":30,"height":10},{"x":525,"y":1865,"width":70,"height":10},{"x":65,"y":1875,"width":30,"height":10},{"x":270,"y":1880,"width":140,"height":20},{"x":530,"y":1875,"width":80,"height":10},{"x":65,"y":1885,"width":30,"height":10},{"x":530,"y":1885,"width":80,"height":10},{"x":660,"y":1900,"width":120,"height":40},{"x":65,"y":1895,"width":30,"height":10},{"x":260,"y":1895,"width":120,"height":10},{"x":530,"y":1895,"width":80,"height":10},{"x":65,"y":1905,"width":30,"height":10},{"x":255,"y":1910,"width":110,"height":20},{"x":530,"y":1905,"width":80,"height":10},{"x":65,"y":1915,"width":30,"height":10},{"x":530,"y":1915,"width":80,"height":10},{"x":65,"y":1925,"width":30,"height":10},{"x":250,"y":1925,"width":100,"height":10},{"x":315,"y":1935,"width":10,"height":30},{"x":430,"y":1925,"width":60,"height":10},{"x":525,"y":1940,"width":70,"height":40},{"x":655,"y":1980,"width":130,"height":120},{"x":65,"y":1935,"width":30,"height":10},{"x":245,"y":1940,"width":110,"height":20},{"x":435,"y":1935,"width":50,"height":10},{"x":65,"y":1945,"width":30,"height":10},{"x":425,"y":1950,"width":30,"height":20},{"x":455,"y":1950,"width":10,"height":20},{"x":65,"y":1955,"width":30,"height":10},{"x":245,"y":1955,"width":130,"height":10},{"x":65,"y":1965,"width":30,"height":10},{"x":235,"y":1970,"width":110,"height":20},{"x":305,"y":1970,"width":10,"height":20},{"x":390,"y":1965,"width":20,"height":10},{"x":435,"y":1965,"width":30,"height":10},{"x":65,"y":1975,"width":30,"height":10},{"x":385,"y":1980,"width":10,"height":20},{"x":435,"y":1975,"width":50,"height":10},{"x":65,"y":1985,"width":30,"height":10},{"x":225,"y":2010,"width":90,"height":60},{"x":295,"y":1985,"width":10,"height":10},{"x":65,"y":1995,"width":30,"height":10},{"x":290,"y":1995,"width":20,"height":10},{"x":70,"y":2005,"width":40,"height":10},{"x":285,"y":2010,"width":10,"height":20},{"x":70,"y":2015,"width":40,"height":10},{"x":75,"y":2025,"width":50,"height":10},{"x":275,"y":2025,"width":10,"height":10},{"x":75,"y":2035,"width":50,"height":10},{"x":275,"y":2035,"width":10,"height":10},{"x":75,"y":2045,"width":50,"height":10},{"x":215,"y":2065,"width":70,"height":50},{"x":660,"y":2045,"width":120,"height":10},{"x":80,"y":2055,"width":60,"height":10},{"x":655,"y":2065,"width":130,"height":30},{"x":85,"y":2065,"width":70,"height":10},{"x":400,"y":2065,"width":140,"height":10},{"x":90,"y":2075,"width":80,"height":10},{"x":395,"y":2075,"width":170,"height":10},{"x":95,"y":2085,"width":90,"height":10},{"x":395,"y":2085,"width":210,"height":10},{"x":615,"y":2085,"width":210,"height":10},{"x":160,"y":2095,"width":220,"height":10},{"x":500,"y":2095,"width":440,"height":10},{"x":385,"y":2105,"width":670,"height":10},{"x":385,"y":2115,"width":670,"height":10},{"x":385,"y":2125,"width":670,"height":10},{"x":385,"y":2135,"width":670,"height":10},{"x":385,"y":2145,"width":670,"height":10},{"x":385,"y":2155,"width":670,"height":10}] diff --git a/assets/img/map/cave.png b/assets/img/map/cave.png new file mode 100644 index 0000000..0cbc8dd Binary files /dev/null and b/assets/img/map/cave.png differ diff --git a/assets/img/tiles/tileset.png b/assets/img/map/tileset.png similarity index 100% rename from assets/img/tiles/tileset.png rename to assets/img/map/tileset.png diff --git a/assets/worlds/mainworld.json b/assets/worlds/mainworld.json index 45a78a5..ca552aa 100644 --- a/assets/worlds/mainworld.json +++ b/assets/worlds/mainworld.json @@ -3,6 +3,10 @@ "x": 10000.0, "y": 10000.0 }, + "player_spawn": { + "x": 220.0, + "y": 50.0 + }, "fish": [ { "x": 500.0, diff --git a/src/gamecore.rs b/src/gamecore.rs index a29e2fa..d8216b7 100644 --- a/src/gamecore.rs +++ b/src/gamecore.rs @@ -107,6 +107,7 @@ impl GameCore { world: World, progress: GameProgress, ) -> Self { + let player = Player::new(&world.player_spawn); Self { state: GameState::Loading, last_state: GameState::Loading, @@ -117,13 +118,13 @@ impl GameCore { .expect("Failed to load game assets. Can not launch!"), master_camera: Camera2D { offset: Vector2::zero(), - target: Vector2::zero(), + target: world.player_spawn, rotation: 0.0, zoom: 2.0, }, show_simple_debug_info: false, world: world, - player: Player::new(), + player, progress: progress, } } diff --git a/src/logic/ingame/mod.rs b/src/logic/ingame/mod.rs index a5b640b..18ab910 100644 --- a/src/logic/ingame/mod.rs +++ b/src/logic/ingame/mod.rs @@ -6,6 +6,7 @@ use raylib::prelude::*; use crate::{ gamecore::{GameCore, GameState}, lib::wrappers::audio::player::AudioPlayer, + pallette::{SKY, WATER}, }; use super::screen::Screen; @@ -31,7 +32,48 @@ impl InGameScreen { context_2d: &mut RaylibMode2D, game_core: &mut GameCore, ) { - context_2d.draw_circle(0, 0, 10.0, Color::BLACK); + // Build source bounds + let source_bounds = Rectangle { + x: 0.0, + y: 0.0, + width: game_core.resources.cave_mid_layer.width as f32, + height: game_core.resources.cave_mid_layer.height as f32, + }; + let world_bounds = Rectangle { + x: 0.0, + y: 0.0, + width: game_core.resources.cave_mid_layer.width as f32, + height: game_core.resources.cave_mid_layer.height as f32, + }; + + // Clear the background + context_2d.draw_rectangle_rec(world_bounds, WATER); + + // Render the world texture + context_2d.draw_texture_rec( + &game_core.resources.cave_mid_layer, + source_bounds, + Vector2 { + x: world_bounds.x, + y: world_bounds.y, + }, + Color::WHITE, + ); + } + + fn render_colliders( + &mut self, + context_2d: &mut RaylibMode2D, + game_core: &mut GameCore, + ) { + // Render every collider + for collider in game_core.world.colliders.iter() { + context_2d.draw_rectangle_lines_ex( + collider, + 1, + Color::RED, + ); + } } } @@ -47,7 +89,7 @@ impl Screen for InGameScreen { let dt = draw_handle.get_time() - game_core.last_frame_time; // Clear frame - draw_handle.clear_background(Color::BLUE); + draw_handle.clear_background(Color::BLACK); // Handle the pause menu being opened if draw_handle.is_key_pressed(KeyboardKey::KEY_ESCAPE) { @@ -72,6 +114,9 @@ impl Screen for InGameScreen { // Render the world self.render_world(&mut context_2d, game_core); + if game_core.show_simple_debug_info{ + self.render_colliders(&mut context_2d, game_core); + } // Render entities let fish_clone = game_core.world.fish.clone(); diff --git a/src/logic/ingame/playerlogic.rs b/src/logic/ingame/playerlogic.rs index 1460984..6446ec5 100644 --- a/src/logic/ingame/playerlogic.rs +++ b/src/logic/ingame/playerlogic.rs @@ -129,8 +129,20 @@ pub fn update_player_movement( // Only do this if the mouse is far enough away let player_real_movement = game_core.player.direction * speed_multiplier; if raw_movement_direction.distance_to(Vector2::zero()) > game_core.player.size.y / 2.0 { - game_core.player.position += player_real_movement; game_core.player.is_moving = true; + game_core.player.position += player_real_movement; + + // Check for any collisions + for collider in game_core.world.colliders.iter() { + if game_core.player.collides_with_rec(collider) { + game_core.player.is_moving = false; + break; + } + } + + if !game_core.player.is_moving { + game_core.player.position -= player_real_movement; + } } else { game_core.player.is_moving = false; } @@ -142,9 +154,19 @@ pub fn update_player_movement( draw_handle.get_world_to_screen2D(game_core.player.position, game_core.master_camera); // Camera only moves if you get close to the edge of the screen - if player_screen_position.distance_to(window_center).abs() > (window_center.y - 40.0) { + if player_screen_position.distance_to(window_center).abs() > 100.0 { game_core.master_camera.target += player_real_movement; } + + // If the player is not on screen, snap the camera to them + if player_screen_position.distance_to(window_center).abs() > window_center.y { + game_core.master_camera.target = game_core.player.position - (window_center / 2.0); + } + + // // Clamp camera target y to 0 + // if game_core.master_camera.target.y < -100.0 { + // game_core.master_camera.target.y = -100.0; + // } } pub fn render_player(context_2d: &mut RaylibMode2D, game_core: &mut GameCore) { diff --git a/src/main.rs b/src/main.rs index f32fd0f..75a8769 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ use lib::{utils::profiler::GameProfiler, wrappers::audio::player::AudioPlayer}; use log::info; use logic::{gameend::GameEndScreen, ingame::InGameScreen, loadingscreen::LoadingScreen, mainmenu::MainMenuScreen, pausemenu::PauseMenuScreen, screen::Screen}; use raylib::prelude::*; -use world::World; +use world::{World, load_world_colliders}; // Game Launch Configuration const DEFAULT_WINDOW_DIMENSIONS: Vector2 = Vector2 { @@ -32,7 +32,7 @@ fn main() { .size( DEFAULT_WINDOW_DIMENSIONS.x as i32, DEFAULT_WINDOW_DIMENSIONS.y as i32, - ) + ).msaa_4x() .title(WINDOW_TITLE) .build(); raylib.set_target_fps(MAX_FPS); @@ -41,7 +41,8 @@ fn main() { raylib.set_exit_key(None); // Load the world - let world = World::load_from_json("./assets/worlds/mainworld.json".to_string()).expect("Failed to load main world JSON"); + let world_colliders = load_world_colliders("./assets/img/map/cave.json".to_string()).expect("Failed to load world colliders"); + let world = World::load_from_json("./assets/worlds/mainworld.json".to_string(), world_colliders).expect("Failed to load main world JSON"); // Load the game progress let game_progress = GameProgress::try_from_file("./assets/savestate.json".to_string()); diff --git a/src/pallette.rs b/src/pallette.rs index 9d70e98..5d675ca 100644 --- a/src/pallette.rs +++ b/src/pallette.rs @@ -19,4 +19,18 @@ pub const TRANSLUCENT_WHITE_64: Color = Color { g: 255, b: 255, a: 64, +}; + +pub const SKY: Color = Color { + r: 15, + g: 193, + b: 217, + a: 255 +}; + +pub const WATER: Color = Color { + r: 24, + g: 66, + b: 143, + a: 255 }; \ No newline at end of file diff --git a/src/player.rs b/src/player.rs index 95c34a2..01c5343 100644 --- a/src/player.rs +++ b/src/player.rs @@ -1,6 +1,6 @@ -use raylib::math::Vector2; - +use raylib::math::{Rectangle, Vector2}; +use crate::lib::utils::triangles::rotate_vector; #[derive(Debug, Default)] pub struct Player { @@ -12,20 +12,48 @@ pub struct Player { pub breath_percent: f32, pub is_moving: bool, pub is_boosting: bool, - pub is_boost_charging: bool + pub is_boost_charging: bool, } impl Player { - pub fn new() -> Self { + pub fn new(spawn: &Vector2) -> Self { Self { boost_percent: 1.0, - size: Vector2 { - x: 11.0, - y: 21.0 - }, + size: Vector2 { x: 11.0, y: 21.0 }, breath_percent: 1.0, + position: spawn.clone(), ..Default::default() - } } -} \ No newline at end of file + + pub fn collides_with_rec(&self, rectangle: &Rectangle) -> bool { + // // Build a bounding box of the player by their corners + // let top_left_corner = self.position - (self.size / 2.0); + // let bottom_right_corner = self.position + (self.size / 2.0); + // let top_right_corner = Vector2 { + // x: bottom_right_corner.x, + // y: top_left_corner.y, + // }; + // let bottom_left_corner = Vector2 { + // x: top_left_corner.x, + // y: bottom_right_corner.y, + // }; + + // // Get the rotation + // let rotation = Vector2::zero().angle_to(self.direction); + + // // Rotate the bounds + // let top_left_corner = rotate_vector(top_left_corner, rotation); + // let bottom_right_corner = rotate_vector(bottom_right_corner, rotation); + // let top_right_corner = rotate_vector(top_right_corner, rotation); + // let bottom_left_corner = rotate_vector(bottom_left_corner, rotation); + + // // Check for collisions + // return rectangle.check_collision_point_rec(top_left_corner) + // || rectangle.check_collision_point_rec(bottom_right_corner) + // || rectangle.check_collision_point_rec(top_right_corner) + // || rectangle.check_collision_point_rec(bottom_left_corner); + + return rectangle.check_collision_circle_rec(self.position, (self.size.y * 0.5) / 2.0); + } +} diff --git a/src/resources.rs b/src/resources.rs index 7397358..b88c5a4 100644 --- a/src/resources.rs +++ b/src/resources.rs @@ -16,6 +16,9 @@ pub struct GlobalResources { pub player_animation_regular: FrameAnimationWrapper, pub player_animation_boost_charge: FrameAnimationWrapper, pub player_animation_boost: FrameAnimationWrapper, + + // Cave + pub cave_mid_layer: Texture2D } impl GlobalResources { @@ -56,6 +59,10 @@ impl GlobalResources { 21, 30, ), + cave_mid_layer: raylib.load_texture_from_image( + &thread, + &Image::load_image("./assets/img/map/cave.png")?, + )?, }) } } diff --git a/src/world.rs b/src/world.rs index 050d284..1f344fe 100644 --- a/src/world.rs +++ b/src/world.rs @@ -1,6 +1,6 @@ use std::{fs::File, io::BufReader}; -use raylib::math::Vector2; +use raylib::math::{Rectangle, Vector2}; use serde::{Deserialize, Serialize}; use std::io::Read; use failure::Error; @@ -10,16 +10,20 @@ use crate::entities::fish::FishEntity; #[derive(Debug, Serialize, Deserialize, Clone)] pub struct World { pub end_position: Vector2, + pub player_spawn: Vector2, #[serde(rename = "fish")] pub fish_positions: Vec, #[serde(skip)] - pub fish: Vec + pub fish: Vec, + + #[serde(skip)] + pub colliders: Vec } impl World { - pub fn load_from_json(file: String) -> Result { + pub fn load_from_json(file: String, colliders: Vec) -> Result { // Load the file let file = File::open(file)?; let reader = BufReader::new(file); @@ -30,6 +34,17 @@ impl World { // Init all fish result.fish = FishEntity::new_from_positions(&result.fish_positions); + // Init colliders + result.colliders = Vec::new(); + for collider in colliders.iter(){ + result.colliders.push(Rectangle { + x: collider.x - (collider.width / 2.0), + y: collider.y - (collider.height / 2.0), + width: collider.width, + height: collider.height, + }); + } + Ok(result) } @@ -45,3 +60,13 @@ impl World { } } } + + +pub fn load_world_colliders(file: String) -> Result, Error> { + // Load the file + let file = File::open(file)?; + let reader = BufReader::new(file); + + // Deserialize + Ok(serde_json::from_reader(reader)?) +} \ No newline at end of file