fix collide tool h et w en inverse

This commit is contained in:
Baptiste 2023-12-25 16:14:16 +01:00
parent 7faf448d79
commit 6ba87b2f4b
2 changed files with 21 additions and 9 deletions

View file

@ -40,8 +40,8 @@ let portals = [new Portal(250,457,0,516,789,1),//O
new Portal(569,828,3,1152,519,0),//out map 3
new Portal(105, 852,4,365,800,0), //out map 4
new Portal(110,122,5,880,255,0), //out map 5
new Portal(231,480,5,131,313,6), //pour aller a l'étage (map6)
new Portal(123,353,6,317,493,5), //out map6 (pour aller a map5)
new Portal(231,475,5,131,313,6), //pour aller a l'étage (map6)
new Portal(115,353,6,317,493,5), //out map6 (pour aller a map5)
new Portal(948,517,7,740,815,0), //out map7
new Portal(1075,421,8,985,520,0) //out map8
];
@ -50,11 +50,12 @@ let map0Squares = [new Square(1064,371,0,126,125),new Square(1160,113,0,143,126)
let map1Squares = [new Square(1,0,1,1020,160),new Square(868,48,1,153,969),new Square(2,838,1,1019,182),new Square(1,0,1,148,998)];
let map2Squares = [new Square(25,936,2,989,83),new Square(1,1,2,98,974),new Square(5,8,2,1002,250),new Square(941,10,2,80,1002),new Square(816,617,2,146,168),new Square(764,252,2,48,214),new Square(805,282,2,154,92),new Square(406,233,2,195,166),new Square(94,418,2,155,88),new Square(94,277,2,127,68),new Square(198,762,2,60,103),new Square(225,880,2,53,30),new Square(116,854,2,35,32)];
let map3Squares = [new Square(19,836,3,857,48),new Square(706,324,3,180,531),new Square(640,321,3,75,168),new Square(832,10,3,60,325),new Square(3,2,3,843,165),new Square(354,48,3,90,302),new Square(256,321,3,287,165),new Square(1,1,3,62,374),new Square(51,320,3,109,157),new Square(4,434,3,90,436),new Square(146,680,3,124,71),new Square(92,754,3,32,88),new Square(290,554,3,220,36),new Square(708,150,3,87,68),new Square(323,206,3,39,59),new Square(50,127,3,72,93),new Square(448,648,3,61,44),new Square(578,645,3,92,45),new Square(802,236,3,36,60)];
let map4Squares = [new Square(100.96875,64,4,47,45),new Square(280.96875,46,4,42,39),new Square(342.96875,58,4,47,41),new Square(333.96875,237,4,37,38),new Square(382.96875,209,4,39,39),new Square(515.96875,53,4,91,91),new Square(530.96875,150,4,65,-11),new Square(615.96875,68,4,-11,59),new Square(509.96875,130,4,8,-60),new Square(530.96875,45,4,66,16),new Square(699.96875,48,4,85,39),new Square(853.96875,159,4,50,67),new Square(527.96875,403,4,45,-26),new Square(943.96875,109,4,25,273),new Square(1105.96875,137,4,47,122),new Square(1106.96875,302,4,46,125),new Square(610.96875,674,4,46,122),new Square(616.96875,810,4,128,48),new Square(846.96875,52,4,11,39),new Square(856.96875,35,4,64,74),new Square(941.96875,34,4,-23,409),new Square(920.96875,448,4,100,-16),new Square(1101.96875,432,4,89,16),new Square(660.96875,39,4,19,252),new Square(761.96875,278,4,-97,19),new Square(838.96875,279,4,84,15),new Square(27.96875,279,4,93,19),new Square(197.96875,279,4,246,19),new Square(446.96875,298,4,-18,-266),new Square(0.96875,1,4,39,904),new Square(31.96875,1,4,6,0),new Square(34.96875,0,4,1181,36),new Square(1183.96875,22,4,32,882),new Square(-0.03125,872,4,1,0),new Square(-0.03125,870,4,1215,35),new Square(480.96875,354,4,119,16),new Square(176.96875,650,4,98,15),new Square(174.96875,650,4,20,223),new Square(355.96875,647,4,246,15),new Square(605.96875,870,4,-22,-223),new Square(477.96875,640,4,123,7),new Square(695.96875,443,4,-15,126),new Square(501.96875,546,4,84,46),new Square(524.96875,596,4,46,46),new Square(402.96875,451,4,18,-19),new Square(411.96875,439,4,20,-21),new Square(425.96875,424,4,24,-23),new Square(441.96875,407,4,21,-21),new Square(455.96875,392,4,28,-25),new Square(592.96875,359,4,0,0),new Square(592.96875,359,4,19,16),new Square(602.96875,366,4,22,20),new Square(615.96875,381,4,23,17),new Square(625.96875,386,4,25,23),new Square(640.96875,401,4,25,23),new Square(658.96875,418,4,22,16),new Square(674.96875,427,4,12,19),new Square(600.96875,649,4,18,-15),new Square(610.96875,639,4,21,-21),new Square(626.96875,622,4,22,-22),new Square(642.96875,605,4,18,-14),new Square(654.96875,595,4,23,-24),new Square(670.96875,580,4,15,-19),new Square(400.96875,563,4,17,16),new Square(410.96875,572,4,19,23),new Square(421.96875,586,4,19,17),new Square(436.96875,598,4,22,17),new Square(447.96875,610,4,17,16),new Square(462.96875,622,4,15,16),new Square(469.96875,629,4,16,14)]
let map5Squares = [new Square(519.96875,51,5,84,114),new Square(638.96875,52,5,80,115),new Square(749.96875,51,5,81,116),new Square(640.96875,395,5,79,116),new Square(751.96875,396,5,86,126),new Square(845.96875,7,5,49,547),new Square(849.96875,56,5,-840,-53),new Square(220.96875,44,5,228,60),new Square(9.96875,0,5,101,356),new Square(501.96875,221,5,35,200),new Square(385.96875,396,5,151,29),new Square(101.96875,213,5,214,15),new Square(351.96875,449,5,-343,-100),new Square(10.96875,447,5,74,108),new Square(205.96875,506,5,688,51),new Square(205.96875,555,5,-193,-35),new Square(298.96875,476,5,-223,-44)]
let map6Squares = [new Square(110.96875,27,6,-103,510),new Square(98.96875,509,6,789,27),new Square(850.96875,30,6,47,501),new Square(99.96875,52,6,755,-24),new Square(131.96875,255,6,-29,53),new Square(560.96875,253,6,174,58),new Square(743.96875,269,6,25,26),new Square(696.96875,224,6,22,23),new Square(693.96875,315,6,22,26),new Square(640.96875,314,6,25,29),new Square(637.96875,224,6,30,24),new Square(578.96875,223,6,27,24),new Square(159.04434628210126,222.0078125,6,-53.00045905331082,-45),new Square(147.04424234550257,84.0078125,6,-50.00043306916113,-42),new Square(162.04437226625092,104.0078125,6,-32.00027716426314,-25),new Square(167.04441557316704,46.0078125,6,67.00058031267594,36),new Square(235.0450045472262,94.0078125,6,-34.00029448702958,-26),new Square(381.04626910917676,66.0078125,6,34.00029448702958,21),new Square(509.04737776622926,46.0078125,6,55.000476376077245,49),new Square(524.0475076869776,88.0078125,6,34.00029448702958,31),new Square(555.0477761898575,46.0078125,6,49.00042440777793,28),new Square(787.0497856307652,63.0078125,6,30.0002598414967,27),new Square(813.050010826729,43.0078125,6,40.000346455328895,65),new Square(601.0481746134858,461.0078125,6,91.00078818587326,44),new Square(583.0480187085877,482.0078125,6,131.00113464120227,27),new Square(337.04588800831493,481.0078125,6,-182.00157637174658,31),new Square(178.0445108483825,487.0078125,6,-21.000181889047667,-146),new Square(232.0449785630765,208.0078125,6,28.000242518730232,79),new Square(232.0449785630765,207.0078125,6,103.00089212247198,13),new Square(347.0459746221472,349.0078125,6,69.00059763544238,24)]
let map7Squares = [new Square(864.96875,306,7,5,356),new Square(288.96875,92,7,667,-32),new Square(933.96875,504,7,27,-445),new Square(291.96875,635,7,579,31),new Square(866.96875,653,7,89,13),new Square(932.96875,579,7,24,85),new Square(933.96875,577,7,79,16),new Square(935.96875,503,7,76,-13),new Square(206.96875,350,7,-149,-54),new Square(208.96875,427,7,-165,-50),new Square(292.96875,654,7,-118,14),new Square(290.96875,73,7,-113,-17),new Square(288.96875,84,7,4,136),new Square(286.96875,506,7,8,148),new Square(288.96875,214,7,49,7),new Square(287.96875,505,7,48,6),new Square(426.96875,90,7,92,50),new Square(565.96875,90,7,94,54),new Square(710.96875,89,7,93,53),new Square(714.96875,585,7,90,49),new Square(571.96875,585,7,93,52),new Square(426.96875,585,7,93,53),new Square(81.96875,248,7,-51,250),new Square(1000.96875,497,7,10,93)]
let map8Squares = [new Square(179.96875,739,8,245,12),new Square(336.96875,508,8,-9,232),new Square(335.96875,364,8,-11,-238),new Square(1117.96875,176,8,17,588),new Square(1099,178.79999923706055,8,45,-62),new Square(1101,138.79999923706055,8,-101,-24),new Square(995,146.79999923706055,8,27,-41),new Square(1060,147.79999923706055,8,28,-35),new Square(989,122.79999923706055,8,12,-32),new Square(1002,84.79999923706055,8,0,0),new Square(1002,84.79999923706055,8,0,0),new Square(1002,84.79999923706055,8,0,0),new Square(756,99.79999923706055,8,268,-25),new Square(753,147.79999923706055,8,-92,-77),new Square(665,99.79999923706055,8,-260,-32),new Square(432,123.79999923706055,8,-37,-52),new Square(426,145.79999923706055,8,-26,-35),new Square(402,134.79999923706055,8,-77,-29),new Square(357,145.79999923706055,8,-29,-37),new Square(180,133.79999923706055,8,167,-26),new Square(1123,727.2000045776367,8,5,37),new Square(1101,694.2000045776367,8,43,80),new Square(1058,725.2000045776367,8,31,33),new Square(1082,735.2000045776367,8,41,16),new Square(995,727.2000045776367,8,29,44),new Square(1062,736.2000045776367,8,-62,27),new Square(986,750.2000045776367,8,26,31),new Square(762,771.2000045776367,8,276,30),new Square(664,725.2000045776367,8,23,28),new Square(680,735.2000045776367,8,64,19),new Square(753,726.2000045776367,8,-19,77),new Square(424,769.2000045776367,8,260,27),new Square(425,726.2000045776367,8,-24,31),new Square(429,750.2000045776367,8,-22,39),new Square(335,728.2000045776367,8,21,11),new Square(371,573.2000045776367,8,286,28),new Square(755,574.2000045776367,8,289,28),new Square(756,655.2000045776367,8,288,28),new Square(373,656.2000045776367,8,284,25),new Square(373,186.79999923706055,8,283,29),new Square(757,186.79999923706055,8,287,28),new Square(756,268.79999923706055,8,288,29),new Square(372,268.79999923706055,8,287,28),new Square(388,178.79999923706055,8,254,46),new Square(770,175.79999923706055,8,261,51),new Square(773,259.79999923706055,8,257,48),new Square(388,258.79999923706055,8,256,50),new Square(386,565.2000045776367,8,258,47),new Square(387,641.2000045776367,8,255,49),new Square(660,745.2000045776367,8,20,46),new Square(772,561.2000045776367,8,253,49),new Square(774,643.2000045776367,8,255,50),new Square(272,157.79999923706055,8,28,169),new Square(270,541.2000045776367,8,29,173),new Square(244,675.2000045776367,8,31,17),new Square(243,617.2000045776367,8,33,18),new Square(246,559.2000045776367,8,30,20),new Square(246,173.79999923706055,8,33,21),new Square(244,230.79999923706055,8,32,21),new Square(244,280.79999923706055,8,32,25),new Square(180,694.2000045776367,8,-35,75),new Square(181,174.79999923706055,8,-37,-84),new Square(157,169.20000457763672,8,-25,561),new Square(167,323.2000045776367,8,-14,221)]
let map4Squares = [new Square(101,64,4,47,45),new Square(281,46,4,42,39),new Square(343,58,4,47,41),new Square(334,237,4,37,38),new Square(383,209,4,39,39),new Square(516,53,4,91,91),new Square(531,139,4,65,11),new Square(605,68,4,11,59),new Square(510,70,4,8,60),new Square(531,45,4,66,16),new Square(700,48,4,85,39),new Square(854,159,4,50,67),new Square(528,377,4,45,26),new Square(944,109,4,25,273),new Square(1106,137,4,47,122),new Square(1107,302,4,46,125),new Square(611,674,4,46,122),new Square(617,810,4,128,48),new Square(847,52,4,11,39),new Square(857,35,4,64,74),new Square(919,34,4,23,409),new Square(921,432,4,100,16),new Square(1102,432,4,89,16),new Square(661,39,4,19,252),new Square(665,278,4,97,19),new Square(839,279,4,84,15),new Square(28,279,4,93,19),new Square(198,279,4,246,19),new Square(429,32,4,18,266),new Square(1,1,4,39,904),new Square(32,1,4,6,0),new Square(35,0,4,1181,36),new Square(1184,22,4,32,882),new Square(0,872,4,1,0),new Square(0,870,4,1215,35),new Square(481,354,4,119,16),new Square(177,650,4,98,15),new Square(175,650,4,20,223),new Square(356,647,4,246,15),new Square(584,647,4,22,223),new Square(478,640,4,123,7),new Square(681,443,4,15,126),new Square(502,546,4,84,46),new Square(525,596,4,46,46),new Square(403,432,4,18,19),new Square(412,418,4,20,21),new Square(426,401,4,24,23),new Square(442,386,4,21,21),new Square(456,367,4,28,25),new Square(593,359,4,0,0),new Square(593,359,4,19,16),new Square(603,366,4,22,20),new Square(616,381,4,23,17),new Square(626,386,4,25,23),new Square(641,401,4,25,23),new Square(659,418,4,22,16),new Square(675,427,4,12,19),new Square(601,634,4,18,15),new Square(611,618,4,21,21),new Square(627,600,4,22,22),new Square(643,591,4,18,14),new Square(655,571,4,23,24),new Square(671,561,4,15,19),new Square(401,563,4,17,16),new Square(411,572,4,19,23),new Square(422,586,4,19,17),new Square(437,598,4,22,17),new Square(448,610,4,17,16),new Square(463,622,4,15,16),new Square(470,629,4,16,14)]
let map5Squares = [new Square(520,51,5,84,114),new Square(639,52,5,80,115),new Square(750,51,5,81,116),new Square(641,395,5,79,116),new Square(752,396,5,86,126),new Square(846,7,5,49,547),new Square(10,3,5,840,53),new Square(221,44,5,228,60),new Square(10,0,5,101,356),new Square(502,221,5,35,200),new Square(386,396,5,151,29),new Square(102,213,5,214,15),new Square(9,349,5,343,100),new Square(11,447,5,74,108),new Square(206,506,5,688,51),new Square(13,520,5,193,35),new Square(76,432,5,223,44)]
let map6Squares = [new Square(8,27,6,103,510),new Square(99,509,6,789,27),new Square(851,30,6,47,501),new Square(100,28,6,755,24),new Square(103,255,6,29,53),new Square(561,253,6,174,58),new Square(744,269,6,25,26),new Square(697,224,6,22,23),new Square(694,315,6,22,26),new Square(641,314,6,25,29),new Square(638,224,6,30,24),new Square(579,223,6,27,24),new Square(106,177,6,53,45),new Square(97,42,6,50,42),new Square(130,79,6,32,25),new Square(167,46,6,67,36),new Square(201,68,6,34,26),new Square(381,66,6,34,21),new Square(509,46,6,55,49),new Square(524,88,6,34,31),new Square(555,46,6,49,28),new Square(787,63,6,30,27),new Square(813,43,6,40,65),new Square(601,461,6,91,44),new Square(583,482,6,131,27),new Square(155,481,6,182,31),new Square(157,341,6,21,146),new Square(232,208,6,28,79),new Square(232,207,6,103,13),new Square(347,349,6,69,24)]
let map7Squares = [new Square(865,306,7,5,356),new Square(289,60,7,667,32),new Square(934,59,7,27,445),new Square(292,635,7,579,31),new Square(867,653,7,89,13),new Square(933,579,7,24,85),new Square(934,577,7,79,16),new Square(936,490,7,76,13),new Square(58,296,7,149,54),new Square(44,377,7,165,50),new Square(175,654,7,118,14),new Square(178,56,7,113,17),new Square(289,84,7,4,136),new Square(287,506,7,8,148),new Square(289,214,7,49,7),new Square(288,505,7,48,6),new Square(427,90,7,92,50),new Square(566,90,7,94,54),new Square(711,89,7,93,53),new Square(715,585,7,90,49),new Square(572,585,7,93,52),new Square(427,585,7,93,53),new Square(31,248,7,51,250),new Square(1001,497,7,10,93)]
let map8Squares = [new Square(180,739,8,245,12),new Square(328,508,8,9,232),new Square(325,126,8,11,238),new Square(1118,176,8,17,588),new Square(1099,117,8,45,62),new Square(1000,115,8,101,24),new Square(995,106,8,27,41),new Square(1060,113,8,28,35),new Square(989,91,8,12,32),new Square(1002,85,8,0,0),new Square(1002,85,8,0,0),new Square(1002,85,8,0,0),new Square(756,75,8,268,25),new Square(661,71,8,92,77),new Square(405,68,8,260,32),new Square(395,72,8,37,52),new Square(400,111,8,26,35),new Square(325,106,8,77,29),new Square(328,109,8,29,37),new Square(180,108,8,167,26),new Square(1123,727,8,5,37),new Square(1101,694,8,43,80),new Square(1058,725,8,31,33),new Square(1082,735,8,41,16),new Square(995,727,8,29,44),new Square(1000,736,8,62,27),new Square(986,750,8,26,31),new Square(762,771,8,276,30),new Square(664,725,8,23,28),new Square(680,735,8,64,19),new Square(734,726,8,19,77),new Square(424,769,8,260,27),new Square(401,726,8,24,31),new Square(407,750,8,22,39),new Square(335,728,8,21,11),new Square(371,573,8,286,28),new Square(755,574,8,289,28),new Square(756,655,8,288,28),new Square(373,656,8,284,25),new Square(373,187,8,283,29),new Square(757,187,8,287,28),new Square(756,269,8,288,29),new Square(372,269,8,287,28),new Square(388,179,8,254,46),new Square(770,176,8,261,51),new Square(773,260,8,257,48),new Square(388,259,8,256,50),new Square(386,565,8,258,47),new Square(387,641,8,255,49),new Square(660,745,8,20,46),new Square(772,561,8,253,49),new Square(774,643,8,255,50),new Square(272,158,8,28,169),new Square(270,541,8,29,173),new Square(244,675,8,31,17),new Square(243,617,8,33,18),new Square(246,559,8,30,20),new Square(246,174,8,33,21),new Square(244,231,8,32,21),new Square(244,281,8,32,25),new Square(145,694,8,35,75),new Square(144,91,8,37,84),new Square(132,169,8,25,561),new Square(153,323,8,14,221)]
let map4Circles = [new Circle(1057.96875,16,4,61.07372593840988),new Circle(962.96875,54,4,14.866068747318506),new Circle(404.96875,132,4,22.02271554554524),new Circle(184.96875,69,4,20.024984394500787),new Circle(59.96875,67,4,20),new Circle(882.96875,133,4,14.142135623730951),new Circle(890.96875,249,4,17.029386365926403)]
let map5Circles = [new Circle(389.96875,280,5,71.06335201775947),new Circle(346.96875,280,5,77.92945527847606),new Circle(425.96875,439,5,8),new Circle(470.96875,438,5,12),new Circle(518.96875,438,5,9.055385138137417),new Circle(552.96875,397,5,11.045361017187261),new Circle(551.96875,362,5,13.038404810405298),new Circle(299.96875,447,5,25.238858928247925),new Circle(324.96875,443,5,18.867962264113206)]

View file

@ -11,8 +11,19 @@
const data = JSON.parse(jsonString);
const squareArray = data.squares.map(square => `new Square(${square.x},${square.y},${z},${square.w},${square.h})`);
const circleArray = data.circles.map(circle => `new Circle(${circle.x},${circle.y},${z},${circle.r})`);
data.squares.forEach(s => {
if(s.h<0) {
s.h=-1*s.h
s.y=s.y-s.h
}
if(s.w<0) {
s.w=-1*s.w
s.x=s.x-s.w
}
})
const squareArray = data.squares.map(square => `new Square(${Math.round(square.x)},${Math.round(square.y)},${z},${Math.round(square.w)},${Math.round(square.h)})`);
const circleArray = data.circles.map(circle => `new Circle(${Math.round(circle.x)},${Math.round(circle.y)},${z},${Math.round(circle.r)})`);
const resultString = `let map${z}Squares = [${squareArray.join(',')}]<br>let map${z}Circles = [${circleArray.join(',')}]`;
document.getElementById('output').innerHTML = resultString;