diff --git a/public_html/assets/map/map9.jpg b/public_html/assets/map/map9.jpg new file mode 100644 index 0000000..9e9d38a Binary files /dev/null and b/public_html/assets/map/map9.jpg differ diff --git a/public_html/js/global.js b/public_html/js/global.js index 12b6981..c5c1218 100644 --- a/public_html/js/global.js +++ b/public_html/js/global.js @@ -29,7 +29,7 @@ let cars = [new Car(1, 7), new Car(0, 52)]; let portals = [new Portal(250,457,0,516,789,1),//O new Portal(344,758,0,50,852,4), // SO - new Portal(1190,211,0,500,500,0),// NE + new Portal(1190,211,0,871,856,9),// NE new Portal(862,213,0,200,147,5), // N new Portal(1126,472,0,583,810,3),// E new Portal(1076,768,0,484,898,2),// SE @@ -45,7 +45,8 @@ let portals = [new Portal(250,457,0,516,789,1),//O new Portal(948,517,7,740,815,0), //out map7 new Portal(1075,421,8,985,520,0), //out map8 new Portal(209,731,8,235,182,8), //troll map8 - new Portal(209,110,8,235,730,8) //troll map8 + new Portal(209,110,8,235,730,8), //troll map8 + new Portal(500,340,9,500,500,0) //out map 9 (vers suite du donjon) ]; let map0Squares = [new Square(1064,371,0,126,125),new Square(1160,113,0,143,126),new Square(1017,113,0,146,80),new Square(1018,192,0,10,47),new Square(1028,227,0,45,12),new Square(1101,227,0,66,12),new Square(791,113,0,176,126),new Square(522,129,0,103,13),new Square(654,128,0,104,15),new Square(747,144,0,12,34),new Square(748,194,0,10,44),new Square(655,224,0,101,15),new Square(520,227,0,106,13),new Square(522,195,0,11,39),new Square(522,131,0,8,46),new Square(588,154,0,10,22),new Square(651,153,0,10,21),new Square(698,188,0,12,19),new Square(697,373,0,318,124),new Square(697,497,0,158,112),new Square(1001,629,0,188,155),new Square(696,626,0,159,158),new Square(281,627,0,173,156),new Square(168,243,0,61,250),new Square(229,259,0,87,218),new Square(311,242,0,62,254),new Square(296,112,0,79,95),new Square(2,0,0,1350,14),new Square(1337,2,0,130,927),new Square(119,909,0,1250,17),new Square(4,1,0,129,923),new Square(543,156,0,16,18),new Square(559,207,0,16,17),new Square(598,179,0,17,29),new Square(721,157,0,13,17),new Square(673,205,0,14,17)]; @@ -57,7 +58,7 @@ let map5Squares = [new Square(520,51,5,84,114),new Square(639,52,5,80,115),new S 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 map9Squares = [new Square(1,2,9,15,429),new Square(55,179,9,16,303),new Square(2,469,9,67,14),new Square(13,424,9,46,5),new Square(55,110,9,15,31),new Square(71,69,9,0,0),new Square(57,1,9,14,68),new Square(15,0,9,883,14),new Square(885,1,9,15,823),new Square(863,810,9,36,15),new Square(808,755,9,21,70),new Square(629,755,9,268,17),new Square(702,702,9,16,57),new Square(704,810,9,71,16),new Square(704,816,9,12,71),new Square(709,864,9,190,32),new Square(1,880,9,711,16),new Square(164,829,9,31,53),new Square(182,809,9,15,72),new Square(628,756,9,37,87),new Square(0,471,9,16,418),new Square(468,7,9,16,61),new Square(468,53,9,68,16),new Square(522,52,9,16,189),new Square(449,234,9,0,0),new Square(450,232,9,216,19),new Square(577,158,9,15,75),new Square(576,53,9,15,72),new Square(577,52,9,195,17),new Square(813,10,9,13,105),new Square(813,74,9,32,51),new Square(108,52,9,324,18),new Square(415,61,9,15,53),new Square(397,107,9,87,17),new Square(468,107,9,17,63),new Square(450,163,9,34,15),new Square(397,161,9,15,132),new Square(402,178,9,65,18),new Square(162,108,9,195,16),new Square(343,116,9,16,133),new Square(108,56,9,15,192),new Square(110,234,9,87,16),new Square(165,181,9,14,53),new Square(164,180,9,106,16),new Square(254,160,9,16,36),new Square(181,162,9,33,19),new Square(52,521,9,199,17),new Square(217,504,9,34,34),new Square(216,360,9,17,160),new Square(232,341,9,18,87),new Square(578,111,9,85,14),new Square(703,109,9,14,31),new Square(703,109,9,68,13),new Square(755,63,9,18,131),new Square(756,177,9,63,18),new Square(812,160,9,34,33),new Square(810,186,9,15,51),new Square(758,234,9,85,16),new Square(758,244,9,14,175),new Square(630,118,9,14,77),new Square(631,181,9,89,13),new Square(639,163,9,25,22),new Square(702,191,9,15,110),new Square(340,289,9,377,12),new Square(576,298,9,14,122),new Square(632,343,9,31,30),new Square(661,342,9,56,14),new Square(703,342,9,14,34),new Square(703,412,9,139,17),new Square(812,394,9,31,31),new Square(829,396,9,13,320),new Square(758,702,9,83,15),new Square(757,632,9,13,75),new Square(757,577,9,75,13),new Square(810,584,9,25,61),new Square(648,648,9,112,14),new Square(648,648,9,15,67),new Square(525,703,9,139,14),new Square(632,666,9,21,40),new Square(704,520,9,12,130),new Square(705,520,9,86,17),new Square(654,468,9,118,15),new Square(648,369,9,15,167),new Square(812,289,9,12,61),new Square(811,342,9,36,16),new Square(813,287,9,76,15),new Square(52,521,9,19,53),new Square(111,579,9,13,83),new Square(111,576,9,83,14),new Square(182,585,9,11,24),new Square(118,587,9,22,20),new Square(54,648,9,69,15),new Square(53,647,9,17,120),new Square(10,757,9,60,15),new Square(110,288,9,14,233),new Square(162,294,9,17,189),new Square(112,287,9,135,16),new Square(236,235,9,13,64),new Square(237,233,9,121,16),new Square(290,244,9,14,119),new Square(290,357,9,119,22),new Square(345,342,9,64,33),new Square(397,342,9,14,130),new Square(451,413,9,200,15),new Square(290,415,9,15,110),new Square(290,414,9,69,16),new Square(290,523,9,242,15),new Square(344,468,9,266,16),new Square(524,482,9,14,114),new Square(524,595,9,67,15),new Square(577,595,9,14,68),new Square(526,651,9,12,66),new Square(472,651,9,66,12),new Square(472,577,9,11,86),new Square(416,577,9,67,33),new Square(414,577,9,14,139),new Square(416,704,9,68,14),new Square(470,704,9,14,85),new Square(524,756,9,15,77),new Square(577,711,9,16,131),new Square(234,826,9,358,20),new Square(235,811,9,86,18),new Square(234,721,9,18,118),new Square(289,758,9,14,55),new Square(294,758,9,31,13),new Square(109,755,9,131,17),new Square(219,702,9,15,54),new Square(107,700,9,71,17),new Square(162,648,9,14,55),new Square(162,649,9,90,15),new Square(236,579,9,16,85),new Square(290,578,9,15,31),new Square(245,594,9,60,15),new Square(126,716,9,17,39),new Square(107,757,9,18,89),new Square(55,830,9,70,16),new Square(74,809,9,40,25),new Square(291,650,9,14,66),new Square(290,702,9,63,16),new Square(363,773,9,68,16),new Square(414,757,9,16,16),new Square(362,668,9,14,120),new Square(343,535,9,21,182),new Square(359,533,9,18,78),new Square(579,522,9,13,31),new Square(588,522,9,74,14),new Square(631,533,9,15,74),new Square(632,576,9,34,32),new Square(894,822,9,5,44)] 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)] @@ -75,7 +76,8 @@ let maps = [new Game_Map(portals.slice(0,8),0,map0Squares,[]), new Game_Map(portals.slice(12,14),5,map5Squares,map5Circles), new Game_Map(portals.slice(14,15),6,map6Squares,map6Circles), new Game_Map(portals.slice(15,16),7,map7Squares,map7Circles), - new Game_Map(portals.slice(16,19),8,map8Squares,map8Circles)]; + new Game_Map(portals.slice(16,19),8,map8Squares,map8Circles), + new Game_Map(portals.slice(19,21),9,map9Squares,[])]; players.push(new Player(-1,-50,-50,-1,"VOITURES",0)); diff --git a/public_html/js/render.js b/public_html/js/render.js index 76c3743..c4ac0e1 100644 --- a/public_html/js/render.js +++ b/public_html/js/render.js @@ -16,6 +16,7 @@ const map5 = new Image(); const map6 = new Image(); const map7 = new Image(); const map8 = new Image(); +const map9 = new Image(); const orange_portal = new Image(); const blue_portal = new Image(); const portal = new Image(); @@ -34,11 +35,12 @@ map5.src = "./assets/map/map5.jpg"; map6.src = "./assets/map/map6.jpg"; map7.src = "./assets/map/map7.jpg"; map8.src = "./assets/map/map8.jpg"; +map9.src = "./assets/map/map9.jpg"; orange_portal.src = "./assets/orange_portal.webp"; blue_portal.src = "./assets/blue_portal.webp"; portal.src = "./assets/portal.png"; -const mapImages = [map0,map1,map2,map3, map4, map5, map6, map7, map8]; +const mapImages = [map0,map1,map2,map3, map4, map5, map6, map7, map8, map9]; class Render { constructor(idCanvas) { @@ -148,14 +150,23 @@ class Render { } else { - background=mapImages[Math.min(player.z,8)]; + background=mapImages[Math.min(player.z,10)]; } let mapWidth = background.width; let mapHeight = background.height; this.ctx.canvas.width = mapWidth; this.ctx.canvas.height = mapHeight; - this.ctx.drawImage(background, 0, 0, mapWidth, mapHeight); + + if(player.z==9) { + this.ctx.save(); + this.ctx.beginPath(); + this.ctx.arc(player.x, player.y, 100, 0, 2 * Math.PI); + this.ctx.clip(); + } + + this.ctx.drawImage(background, 0, 0, mapWidth, mapHeight); + this.RenderPlayer(player,true); if(drawCollisions) @@ -195,5 +206,15 @@ class Render { this.RenderPortalDebug(portal.out.x,portal.out.y,false) } }); + + + if(player.z==9) { + this.ctx.restore(); + this.ctx.beginPath(); + this.ctx.arc(player.x, player.y, 100, 0, 2 * Math.PI); + this.ctx.lineWidth = 2; + this.ctx.strokeStyle = 'black'; + this.ctx.stroke(); + } } }