diff --git a/public_html/about.html b/public_html/about.html
new file mode 100644
index 0000000..f8412e2
--- /dev/null
+++ b/public_html/about.html
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Ce site a été fait par RODRIGUEZ Leandro, LASSERRE Victor, Marty Killian , et REBILLARD Baptiste.
+
Ce jeu a été fait dans le cadre de la formation de L'INSA Toulouse option IR.
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public_html/assets/map/map10.jpg b/public_html/assets/map/map10.jpg
new file mode 100755
index 0000000..e23f32e
Binary files /dev/null and b/public_html/assets/map/map10.jpg differ
diff --git a/public_html/assets/map/map11.jpg b/public_html/assets/map/map11.jpg
new file mode 100644
index 0000000..2790b07
Binary files /dev/null and b/public_html/assets/map/map11.jpg differ
diff --git a/public_html/assets/map/map4.png b/public_html/assets/map/map4.png
new file mode 100644
index 0000000..e34520d
Binary files /dev/null and b/public_html/assets/map/map4.png differ
diff --git a/public_html/assets/map/map5.jpg b/public_html/assets/map/map5.jpg
new file mode 100644
index 0000000..5dd5d98
Binary files /dev/null and b/public_html/assets/map/map5.jpg differ
diff --git a/public_html/assets/map/map6.jpg b/public_html/assets/map/map6.jpg
new file mode 100644
index 0000000..824ce90
Binary files /dev/null and b/public_html/assets/map/map6.jpg differ
diff --git a/public_html/assets/map/map7.jpg b/public_html/assets/map/map7.jpg
new file mode 100644
index 0000000..b10e1d3
Binary files /dev/null and b/public_html/assets/map/map7.jpg differ
diff --git a/public_html/assets/map/map8.jpg b/public_html/assets/map/map8.jpg
new file mode 100644
index 0000000..ab96d91
Binary files /dev/null and b/public_html/assets/map/map8.jpg differ
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/assets/phone/lester.jpeg b/public_html/assets/phone/lester.jpeg
new file mode 100644
index 0000000..e8a9b3f
Binary files /dev/null and b/public_html/assets/phone/lester.jpeg differ
diff --git a/public_html/assets/phone/webview/lester.html b/public_html/assets/phone/webview/lester.html
new file mode 100644
index 0000000..906f9b6
--- /dev/null
+++ b/public_html/assets/phone/webview/lester.html
@@ -0,0 +1,70 @@
+
+
+
+
+
+ Lester
+
+
+
+
+KILL
+KILL EVERYONE
+COLLISIONS
+FULL LIFE
+SAFE ZONE
+MAP 0
+MAP 1
+MAP 2
+MAP 3
+MAP 4
+MAP 5
+MAP 6
+MAP 7
+MAP 8
+MAP 9
+MAP 10
+MAP 11
+
+
\ No newline at end of file
diff --git a/public_html/assets/portal.png b/public_html/assets/portal.png
new file mode 100644
index 0000000..9481cd0
Binary files /dev/null and b/public_html/assets/portal.png differ
diff --git a/public_html/assets/portal3.png b/public_html/assets/portal3.png
new file mode 100644
index 0000000..fb037e3
Binary files /dev/null and b/public_html/assets/portal3.png differ
diff --git a/public_html/assets/sounds/9mm-pistol-shot-6349.mp3 b/public_html/assets/sounds/9mm-pistol-shot-6349.mp3
deleted file mode 100644
index ce7c13c..0000000
Binary files a/public_html/assets/sounds/9mm-pistol-shot-6349.mp3 and /dev/null differ
diff --git a/public_html/assets/sounds/notification.mp3 b/public_html/assets/sounds/notification.mp3
new file mode 100644
index 0000000..352774a
Binary files /dev/null and b/public_html/assets/sounds/notification.mp3 differ
diff --git a/public_html/assets/water_background.jpg b/public_html/assets/water_background.jpg
deleted file mode 100644
index d0ddfb1..0000000
Binary files a/public_html/assets/water_background.jpg and /dev/null differ
diff --git a/public_html/assets/water_background2.jpg b/public_html/assets/water_background2.jpg
deleted file mode 100644
index 172ef89..0000000
Binary files a/public_html/assets/water_background2.jpg and /dev/null differ
diff --git a/public_html/commands.html b/public_html/commands.html
new file mode 100644
index 0000000..7777f42
--- /dev/null
+++ b/public_html/commands.html
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Commandes :
+
+ - Haut: Z ou fleche du haut
+ - Bas: S ou fleche du bas
+ - Gauche: Q ou fleche de gauche
+ - Droite: D ou fleche de droite
+ - Tirer: Clic Gauche
+ - Viser: Souris
+ - Ouvrir le telephone: P
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public_html/css/game.css b/public_html/css/game.css
index 2a132b4..f2e4ce5 100644
--- a/public_html/css/game.css
+++ b/public_html/css/game.css
@@ -28,6 +28,12 @@ html, body{
user-select: none;
}
+#phoneContainer.notification{
+ position: absolute;
+ right: 20px;
+ top: calc(100% - 40px);
+}
+
#phoneDiv{
position: relative;
}
diff --git a/public_html/css/style.css b/public_html/css/style.css
index 7247e97..4bb8982 100644
--- a/public_html/css/style.css
+++ b/public_html/css/style.css
@@ -17,13 +17,15 @@ body {
}
-footer{
+
+
+footer {
color: rgb(180, 167, 167);
font-weight: bold;
-
+
}
-header{
+header {
display: block;
width: 100vw;
}
@@ -33,21 +35,127 @@ h1 {
color: #ffffff;
}
-h2{
+h2 {
display: none;
}
-#logo{
- display:none;
+#logo {
+ display: none;
}
-@media screen and (min-width: 1200px) {
+#about{
+ color: rgb(255, 255, 255);
+ font-weight: bold;
+ font-family:sans-serif,calibri;
+}
+
+
+@media screen and (max-width: 700px) { /*petit*/
+
+
+ nav {
+ height: 60px;
+ background: #00000050;
+ }
+
+ #toggle {
+ display: none;
+ }
+
+ .menu {
+ display: none;
+ flex-direction: column;
+ background: #00000050;
+ height: 10vh;
+ margin-top: 1.29vh;
+ }
+
+ nav a {
+ margin: 0.8vh;
+ font-size: 1.5em;
+ color: white;
+ text-decoration: none;
+ }
+
+ nav a:hover {
+ color: #dadd0f;
+ }
+
+ .lab {
+ width: 30px;
+ display: flex;
+ margin: 0 auto;
+ font-size: 40px;
+ color: white;
+ cursor: pointer;
+ }
+
+ #toggle:checked+.menu {
+ display: flex;
+ font-weight: bold;
+ }
+ .box{
+ font-size: 1.5em;
+ }
+
+}
+
+@media screen and (min-width: 700px) { /*grand*/
+
+ .box{
+ font-size: 2.5em;
+ }
+ .lab {
+ display: none;
+ }
+
+ #toggle {
+ display: none;
+ }
+
+ nav {
+
+ margin: 0;
+ width: 100%;
+ height: 9.5vh;
+ display: flex;
+ background: #00000050;
+ }
+
+
+
+ nav a {
+ width: 15%;
+ margin-left: 1vw;
+ margin-right: 1vw;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ height: 100px;
+ text-decoration: none;
+ font-size: 1.5em;
+ font-weight: bold;
+ color: white;
+ }
+
+ nav a:hover {
+ color: #dadd0f;
+ }
+
+ nav .menu {
+ display: flex;
+ align-items: center;
+ width: 100%;
+ height: 100%;
+ }
+
#logo {
display: block;
width: 100px;
margin: 10px;
}
+
h2 {
display: block;
/*background-color: rgba(255, 255, 255, 0.466);*/
@@ -83,8 +191,33 @@ main {
}
+ul{
+ color:rgb(255, 255, 255);
+ font-weight: bold;
+ list-style-type: none;
+ font-family: sans-serif,calibri;
+}
-
+h3{
+ color: rgb(255, 255, 255);
+ font-weight: bold ;
+ text-decoration: underline;
+ margin-bottom: 0;
+
+}
+.box {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ width: 60vw;
+ height: 60vh;
+ background-color: rgba(0, 0, 0, 0.5);
+ border-radius: 20px;
+ margin: 10px;
+ padding: 10px;
+
+}
#background-image {
background-image: url('../assets/bg.webp');
diff --git a/public_html/game.html b/public_html/game.html
index 9dda63f..e197b2d 100644
--- a/public_html/game.html
+++ b/public_html/game.html
@@ -43,6 +43,7 @@
+
@@ -40,4 +49,10 @@
window.addEventListener('keyup', (event) => {
document.cookie = "pseudo=" + pseudo.value
})
-
+
+ function moveFocus(){
+ setTimeout(function () {
+ document.getElementById('form_input').focus();
+ }, 200)
+ }
+
\ No newline at end of file
diff --git a/public_html/js/class.js b/public_html/js/class.js
index 0502fcd..90837f3 100644
--- a/public_html/js/class.js
+++ b/public_html/js/class.js
@@ -41,6 +41,12 @@ class Player
this.death++;
this.health=defaulthealth;
+ players.forEach((p) => {
+ if(p.id==killerId) {
+ p.kill++;
+ }
+ });
+
net.died(this.id,killerId);
}
}
diff --git a/public_html/js/game.js b/public_html/js/game.js
index 9ddb887..6988aaf 100644
--- a/public_html/js/game.js
+++ b/public_html/js/game.js
@@ -1,13 +1,15 @@
let dt = 0;
let currentTime = new Date();
function game() {
- if(player==null)
+ if(player==null){
return;
+ }
player.update(maps[player.z].squares, maps[player.z].circles, dt);
players.forEach((p)=>{
- if(p.z>=0)
- p.update(maps[p.z].squares,maps[p.z].circles);
+ if(p.z>=0) {
+ p.update(maps[p.z].squares,maps[p.z].circles, dt);
+ }
});
cars.forEach((c) => {
@@ -35,6 +37,7 @@ function game() {
let newTime = new Date();
dt=newTime - currentTime;
currentTime=newTime;
+ Donjon()
}
net.connect(); //connect to server, create a player, and retrieve all players info
diff --git a/public_html/js/global.js b/public_html/js/global.js
index 8bb1c66..3b2071d 100644
--- a/public_html/js/global.js
+++ b/public_html/js/global.js
@@ -4,6 +4,7 @@ let renderer = new Render("canvas");
let LB = new LeaderBoard("canvas");
let bulletSound = new Sound("./assets/sounds/shoot.mp3");
let driftSound = new Sound("./assets/sounds/drift.mp3");
+let notificationSound = new Sound("./assets/sounds/notification.mp3");
let net = new Network("wss://ws.gta6.insat.fr:8080?name=" + getCookie("pseudo"));
let inp = new Input("canvas");
let phone = new Phone();
@@ -28,28 +29,72 @@ let cars = [new Car(1, 7),
//new Car(0, 45),
new Car(0, 52)];
let portals = [new Portal(250,457,0,516,789,1),//O
- new Portal(344,758,0,500,500,0), // SO
- new Portal(1190,211,0,500,500,0),// NE
- new Portal(862,213,0,500,500,0), // N
- new Portal(1126,472,0,583,810,3),// E
+ new Portal(344,758,0,50,852,4), // SO
+ new Portal(1190,211,0,871,856,9),// NE
+ new Portal(862,213,0,200,147,5), // N
+ new Portal(1126,472,0,583,800,3),// E
new Portal(1076,768,0,484,898,2),// SE
- new Portal(721,767,0,500,500,0), // S
- new Portal(970,476,0,500,500,0),//Mid
+ new Portal(721,767,0,917,547,7), // S -> grotte chelou
+ new Portal(970,476,0,1056,449,8),//Mid -> Poudlar
new Portal(617,154,1,274,244,0),//out map 1
new Portal(95,561,2,989,694,0), //out map 2
- new Portal(569,828,3,1152,519,0)];//out map 3
+ new Portal(569,810,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,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
+ new Portal(209,731,8,235,182,8), //troll map8
+ new Portal(209,110,8,235,730,8), //troll map8
+ new Portal(500,340,9,58,269,10), //out map 9 (vers suite du donjon map 10)
+ new Portal(786,254,10,276,860,11), //out map 10 (vers suite du donjon map 11)
+ new Portal(260,399,11,1089,227,0) //sortie vers la map 0
+ ];
-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)];
-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 maps = [new Game_Map(portals.slice(0,8),0,map0Squares,[]),
- new Game_Map(portals.slice(8,9),1,map1Squares,[]),
- new Game_Map(portals.slice(9,10),2,map2Squares,[]),
- new Game_Map(portals.slice(10,11),3,map3Squares,[])];
+let map0Squares = [new Square(1,2,0,135,924),new Square(1337,0,0,132,929),new Square(124,0,0,1235,13),new Square(125,908,0,1218,18),new Square(169,240,0,63,258),new Square(313,241,0,63,257),new Square(231,258,0,82,222),new Square(297,112,0,80,97),new Square(527,129,0,100,13),new Square(792,112,0,177,129),new Square(1018,112,0,151,81),new Square(1161,112,0,145,129),new Square(1020,192,0,8,48),new Square(1020,226,0,55,15),new Square(1104,226,0,58,14),new Square(1065,370,0,126,128),new Square(1001,626,0,192,159),new Square(697,626,0,159,158),new Square(696,370,0,160,240),new Square(853,370,0,165,127),new Square(281,627,0,176,158),new Square(656,129,0,97,14),new Square(750,128,0,5,49),new Square(749,193,0,7,48),new Square(655,224,0,101,17),new Square(527,226,0,100,15),new Square(527,193,0,4,47),new Square(527,129,0,5,47),new Square(590,155,0,7,20),new Square(654,156,0,7,20),new Square(701,186,0,9,22)]
+let map1Squares = [new Square(1,164,1,171,833),new Square(157,847,1,864,175),new Square(855,260,1,168,608),new Square(533,2,1,489,168),new Square(354,3,1,183,169),new Square(3,3,1,361,135),new Square(203,819,1,134,40),new Square(683,816,1,217,36)]
+let map2Squares = [new Square(2,4,2,101,949),new Square(89,2,2,703,193),new Square(286,185,2,496,80),new Square(289,242,2,280,83),new Square(411,302,2,189,107),new Square(563,263,2,50,43),new Square(246,180,2,54,84),new Square(91,277,2,138,96),new Square(95,417,2,152,86),new Square(220,402,2,32,60),new Square(767,278,2,157,130),new Square(770,400,2,39,69),new Square(870,424,2,50,43),new Square(774,2,2,247,208),new Square(922,202,2,100,816),new Square(911,424,2,22,226),new Square(895,532,2,32,97),new Square(819,614,2,103,184),new Square(781,758,2,26,62),new Square(1,934,2,928,85),new Square(195,829,2,42,36),new Square(129,809,2,12,54),new Square(223,874,2,60,42),new Square(221,758,2,44,42),new Square(203,775,2,39,38)]
+let map3Squares = [new Square(3,367,3,94,526),new Square(86,829,3,807,64),new Square(703,365,3,188,479),new Square(640,318,3,253,61),new Square(831,18,3,63,310),new Square(2,0,3,839,64),new Square(1,58,3,62,314),new Square(57,322,3,103,62),new Square(69,130,3,54,85),new Square(257,142,3,103,36),new Square(351,57,3,99,282),new Square(255,319,3,288,159),new Square(289,470,3,223,26),new Square(637,370,3,76,109),new Square(83,370,3,80,109),new Square(287,554,3,225,38),new Square(707,137,3,88,79),new Square(672,54,3,182,129),new Square(442,136,3,98,40),new Square(441,54,3,233,106),new Square(443,254,3,32,28),new Square(802,237,3,31,58),new Square(453,645,3,54,45),new Square(576,645,3,94,45),new Square(145,679,3,127,69),new Square(132,690,3,20,43),new Square(267,689,3,17,39),new Square(161,738,3,91,28),new Square(164,653,3,88,26),new Square(85,754,3,40,84),new Square(59,57,3,326,102),new Square(320,206,3,35,61),new Square(116,150,3,41,33)]
+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 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 map10Squares = [new Square(0,0,10,32,560),new Square(30,0,10,76,70),new Square(105,0,10,705,33),new Square(2,493,10,104,69),new Square(103,528,10,706,32),new Square(212,492,10,69,36),new Square(353,492,10,77,44),new Square(421,457,10,37,72),new Square(69,315,10,37,143),new Square(71,104,10,33,142),new Square(599,29,10,35,25),new Square(352,26,10,105,43),new Square(211,28,10,70,42),new Square(422,29,10,35,76),new Square(455,105,10,37,35),new Square(527,106,10,103,34),new Square(599,86,10,36,90),new Square(563,136,10,71,41),new Square(775,31,10,35,119),new Square(740,100,10,70,110),new Square(740,206,10,34,40),new Square(740,316,10,34,46),new Square(740,352,10,70,108),new Square(776,458,10,32,72),new Square(456,422,10,37,36),new Square(528,421,10,79,37),new Square(598,388,10,36,87),new Square(563,387,10,70,36),new Square(598,509,10,35,21),new Square(806,206,10,4,148)]
+let map11Squares = [new Square(1,2,11,555,89),new Square(1,57,11,117,86),new Square(446,2,11,117,140),new Square(2,625,11,101,354),new Square(2,979,11,0,0),new Square(460,625,11,104,357),new Square(97,908,11,371,72),new Square(187,884,11,189,31),new Square(0,137,11,6,490),new Square(556,136,11,7,494)]
+
+let map0Circles = [new Circle(609,190,0,16),new Circle(729,164,0,11),new Circle(569,213,0,10),new Circle(552,165,0,11),new Circle(680,211,0,10)]
+let map1Circles = [new Circle(142,100,1,151),new Circle(66,806,1,155),new Circle(377,902,1,104),new Circle(441,895,1,74),new Circle(155,502,1,51),new Circle(650,869,1,63),new Circle(609,870,1,49),new Circle(965,946,1,248),new Circle(864,244,1,64),new Circle(841,190,1,64),new Circle(374,184,1,28),new Circle(497,172,1,31),new Circle(439,145,1,62),new Circle(391,167,1,42)]
+let map2Circles = [new Circle(132,874,2,17),new Circle(812,767,2,29),new Circle(183,212,2,21),new Circle(101,187,2,57),new Circle(111,298,2,42),new Circle(131,795,2,34),new Circle(217,824,2,26)]
+let map3Circles = [new Circle(687,517,3,14),new Circle(710,485,3,35),new Circle(690,813,3,13),new Circle(54,210,3,37),new Circle(87,467,3,39)]
+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)]
+let map6Circles = [new Circle(599.96875,330,6,13.892443989449804),new Circle(366.96875,278,6,76.00657866263946),new Circle(386.96875,284,6,73.10950690573696),new Circle(142.96875,178,6,12.041594578792296),new Circle(130.04409510198778,174.0078125,6,13.601480697536704),new Circle(232.0449785630765,60.0078125,6,20.518379508122223),new Circle(419.0465982417392,62.0078125,6,17.117244792645977),new Circle(415.04656359620634,90.0078125,6,22.803582948232627),new Circle(659.0486769737126,63.0078125,6,13.152949072028138),new Circle(690.0489454765926,61.0078125,6,13.928403823519659),new Circle(607.0482265817851,68.0078125,6,16.031220082165973),new Circle(628.0484084708328,75.0078125,6,14),new Circle(584.048027369971,81.0078125,6,16.124517645231),new Circle(831.0501667316271,454.0078125,6,28.42548828525679),new Circle(765.0495950803344,490.0078125,6,22.472229721633212),new Circle(808.0499675198129,492.0078125,6,45.65094067218403),new Circle(684.0488935082933,463.0078125,6,14.866127010225155),new Circle(744.0494131912867,479.0078125,6,11.313757495273405),new Circle(394.0463817071586,497.0078125,6,14.56022929645903),new Circle(256.04518643627387,475.0078125,6,17.20470087749703),new Circle(229.04495257892685,467.0078125,6,17.00003260767031),new Circle(194.04464943051406,475.0078125,6,20.808711985348125),new Circle(382.04627777056,380.0078125,6,15.264373837857004),new Circle(409.04651162790697,370.0078125,6,15.000083149408585),new Circle(252.045151790741,298.0078125,6,13.45367619463759),new Circle(260.04522108180674,319.0078125,6,12.530047727914598),new Circle(265.0452643887229,337.0078125,6,13.000095941537126)]
+let map7Circles = [new Circle(829.96875,545,7,17.204650534085253),new Circle(253.96875,491,7,25.079872407968907),new Circle(256.96875,227,7,22),new Circle(686.96875,541,7,19.026297590440446),new Circle(540.96875,181,7,18.110770276274835),new Circle(395.96875,180,7,19),new Circle(251.96875,178,7,21.37755832643195),new Circle(251.96875,542,7,20),new Circle(395.96875,542,7,20.223748416156685),new Circle(541.96875,543,7,18.027756377319946),new Circle(686.96875,182,7,17.029386365926403),new Circle(827.96875,183,7,19),new Circle(75.96875,233,7,23.08679276123039),new Circle(91.96875,171,7,27.80287754891569),new Circle(127.96875,131,7,19.1049731745428),new Circle(168.96875,86,7,20.591260281974),new Circle(74.96875,494,7,21.18962010041709),new Circle(93.96875,551,7,21.095023109728988),new Circle(127.96875,603,7,17.804493814764857),new Circle(175.96875,647,7,17.69180601295413),new Circle(53.96875,353,7,52.773099207835045),new Circle(70.96875,191,7,29.68164415931166),new Circle(92.96875,125,7,37.48332962798263),new Circle(128.96875,81,7,38.8329756778952),new Circle(177.96875,45,7,41.182520563948),new Circle(59.96875,531,7,34.92849839314596),new Circle(89.96875,595,7,36.40054944640259),new Circle(128.96875,649,7,39.6232255123179),new Circle(190.96875,668,7,21.470910553583888)]
+let map8Circles = [new Circle(746,80.79999923706055,8,31.304951684997057),new Circle(740,789.2000045776367,8,32.64965543462902),new Circle(158,176.79999923706055,8,18.439088914585774),new Circle(157,257.79999923706055,8,16.0312195418814),new Circle(160,341.79999923706055,8,16.0312195418814),new Circle(160,531.2000045776367,8,14.035668847618199),new Circle(150,615.2000045776367,8,26.076809620810597),new Circle(152,701.2000045776367,8,26.1725046566048),new Circle(505,767.2000045776367,8,7.0710678118654755),new Circle(587,765.2000045776367,8,5),new Circle(831,772.2000045776367,8,11),new Circle(916,772.2000045776367,8,8.246211251235321),new Circle(503,100.79999923706055,8,10),new Circle(585,98.79999923706055,8,12.041594578792296),new Circle(830,96.79999923706055,8,13),new Circle(920,95.79999923706055,8,16.76305461424021),new Circle(445,365.79999923706055,8,15.033296378372908),new Circle(587,366.79999923706055,8,12.041594578792296),new Circle(447,503.79999923706055,8,14.035668847618199),new Circle(587,505.79999923706055,8,12),new Circle(830,366.79999923706055,8,12),new Circle(970,366.79999923706055,8,15.620499351813308),new Circle(969,506.79999923706055,8,14.422205101855956),new Circle(836,506.79999923706055,8,15.231546211727817),new Circle(984,361.79999923706055,8,12),new Circle(985,506.79999923706055,8,12.165525060596439),new Circle(840,363.79999923706055,8,13),new Circle(1120,196.79999923706055,8,13),new Circle(1114,270.79999923706055,8,10),new Circle(1116,346.79999923706055,8,12),new Circle(1118,526.2000045776367,8,13.038404810405298),new Circle(1120,602.2000045776367,8,13.038404810405298),new Circle(1115,680.2000045776367,8,10)]
+let map10Circles = [new Circle(448,448,10,10),new Circle(436,458,10,9),new Circle(459,440,10,12),new Circle(446,113,10,11),new Circle(436,99,10,13),new Circle(457,121,10,11),new Circle(316,174,10,20),new Circle(316,386,10,20),new Circle(475,228,10,10),new Circle(687,156,10,10),new Circle(686,403,10,11),new Circle(686,333,10,9),new Circle(687,228,10,10),new Circle(582,228,10,10),new Circle(581,333,10,11),new Circle(474,334,10,10)]
+let map11Circles = [new Circle(281,240,11,20),new Circle(282,210,11,14),new Circle(104,342,11,14),new Circle(461,339,11,14),new Circle(457,505,11,12),new Circle(104,505,11,13),new Circle(189,908,11,17),new Circle(373,907,11,19),new Circle(99,63,11,74),new Circle(460,76,11,60),new Circle(255,349,11,9),new Circle(309,348,11,8),new Circle(236,529,11,7),new Circle(327,530,11,7),new Circle(328,623,11,5),new Circle(236,624,11,7),new Circle(237,716,11,5),new Circle(328,718,11,5),new Circle(328,811,11,5),new Circle(236,812,11,7)]
+
+
+let maps = [new Game_Map(portals.slice(0,8),0,map0Squares,map0Circles),
+ new Game_Map(portals.slice(8,9),1,map1Squares,map1Circles),
+ new Game_Map(portals.slice(9,10),2,map2Squares,map2Circles),
+ new Game_Map(portals.slice(10,11),3,map3Squares,map3Circles),
+ new Game_Map(portals.slice(11,12),4,map4Squares,map4Circles),
+ 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(19,20),9,map9Squares,[]),
+ new Game_Map(portals.slice(20,21),10,map10Squares,map10Circles),
+ new Game_Map(portals.slice(21,22),11,map11Squares,map11Circles)];
+maps[-1]=maps[0]
players.push(new Player(-1,-50,-50,-1,"VOITURES",0));
+
+players.push(new Player(-2,-50,-50,-1,"DONJON",0));
function updatePlayer(data)
{
@@ -57,10 +102,11 @@ function updatePlayer(data)
{
player.x=data.x;
player.y=data.y;
- if(data.z==undefined)
+ if(data.z==undefined){
player.z=0;
- else
+ } else {
player.z=data.z;
+ }
}
else
{
@@ -70,10 +116,11 @@ function updatePlayer(data)
{
players[i].x=data.x;
players[i].y=data.y;
- if(data.z==undefined)
+ if(data.z==undefined){
players[i].z=0;
- else
+ } else {
players[i].z=data.z;
+ }
players[i].dir=data.dir;
players[i].visibleDir=data.visibleDir;
break;
@@ -109,10 +156,12 @@ function addKill(idKilled,idKiller)
player.death++;
}
players.forEach((p) => {
- if(p.id==idKilled)
+ if(p.id==idKilled) {
p.death++;
- if(p.id==idKiller)
+ }
+ if(p.id==idKiller) {
p.kill++;
+ }
});
}
@@ -128,3 +177,62 @@ function updateBullets(dt)
}
}
}
+
+let lastbulletdonjon=[0,0]
+function Donjon() {
+ if(player.z==10) {
+ if(lastbulletdonjon[1]>=7) {
+ lastbulletdonjon[1]=0
+ bullets.push(new Bullet(107,95+(Date.now()*0.1)%365,10,1,0,-2));
+ bullets.push(new Bullet(107,460-(Date.now()*0.1)%365,10,1,0,-2));
+ } else {
+ lastbulletdonjon[1]++
+ }
+ if(lastbulletdonjon[0]==59 && Math.floor(Date.now()/1000)%60 !=59) { lastbulletdonjon[0]=0 }
+ if(Math.floor(Date.now()/1000)%60 > lastbulletdonjon[0]) {
+ lastbulletdonjon[0]=Math.floor(Date.now()/1000)%60
+ for(let i=0;i<5;i++){
+ bullets.push(new Bullet(235,65,10,0,2,-2));
+ bullets.push(new Bullet(235,491,10,0,-2,-2));
+ bullets.push(new Bullet(395,65,10,0,2,-2));
+ bullets.push(new Bullet(395,491,10,0,-2,-2));
+ bullets.push(new Bullet(615,178,10,0,2,-2));
+ bullets.push(new Bullet(615,385,10,0,-2,-2));
+ }
+ }
+ }
+}
+
+function Lester(type, data) {
+ switch(type) {
+ case 1:
+ player.x=data[0]
+ player.y=data[1]
+ player.z=data[2]
+ net.update(player);
+ break;
+ case 2:
+ player.health=defaulthealth
+ break;
+ case 3:
+ addKill(data, player.id)
+ net.died(data, player.id)
+ break;
+ case 4:
+ players.forEach((p) => {
+ if(p.id>0) {
+ net.died(p.id, player.id)
+ addKill(data, player.id)
+ p.death++
+ }
+ });
+ break;
+ case 5:
+ if(drawCollisions) {
+ drawCollisions=false
+ } else {
+ drawCollisions=true
+ }
+ break;
+ }
+}
\ No newline at end of file
diff --git a/public_html/js/input.js b/public_html/js/input.js
index 4591057..e841198 100644
--- a/public_html/js/input.js
+++ b/public_html/js/input.js
@@ -52,7 +52,7 @@ class Input {
window.addEventListener("keydown", (e)=>{
//blocks the action of the key (cf. Killian)
- if(["Space","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.code)) {
+ if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.code)) {
e.preventDefault();
}
this.keysDown.add(e.key.toLowerCase())
diff --git a/public_html/js/leaderboard.js b/public_html/js/leaderboard.js
index 3940447..b01d1c2 100644
--- a/public_html/js/leaderboard.js
+++ b/public_html/js/leaderboard.js
@@ -10,7 +10,7 @@ class LeaderBoard {
ReloadAff() {
let LBplayers=[];
players.forEach((p) => {
- if(p != null) {
+ if(p != null && (p.id >0 || p.kill>0 || p.death>0)) {
LBplayers.push(p);
}
})
@@ -52,8 +52,8 @@ class LeaderBoard {
this.ctx.fillText((this.nbjoueur+1), this.px+10, this.py+120+20*this.nbjoueur);
this.ctx.fillText(p.name, this.px+30, this.py+120+20*this.nbjoueur);
this.ctx.fillText(p.kill, this.px+180, this.py+120+20*this.nbjoueur);
- this.ctx.fillText(p.death, this.px+200, this.py+120+20*this.nbjoueur);
- this.ctx.fillText(Math.round(10*p.kill/p.death)/10, this.px+220, this.py+120+20*this.nbjoueur);
+ this.ctx.fillText(p.id>0 ? p.death : "-", this.px+200, this.py+120+20*this.nbjoueur);
+ this.ctx.fillText(p.id>0 ? Math.round(10*p.kill/p.death)/10 : "-", this.px+220, this.py+120+20*this.nbjoueur);
this.nbjoueur++;
}
diff --git a/public_html/js/network.js b/public_html/js/network.js
index 553e1b7..312a4c5 100644
--- a/public_html/js/network.js
+++ b/public_html/js/network.js
@@ -34,13 +34,22 @@ class Network{
bullets.push(new Bullet(data.data.x,data.data.y,data.data.z==undefined?0:data.data.z,data.data.dx,data.data.dy,data.data.id));
break;
- case "died":
+ case "died":
console.log("player",data.data.id,"was killed by",data.data.killerId);
addKill(data.data.id,data.data.killerId);
break;
case "message":
phone.addMessage(data.data);
+ break;
+
+ case "kick":
+ if(data.data.player_id == player.id){
+ alert("Vous avez essayé de tricher, vous jouez maintenant en solo.");
+ }else{
+ console.log("Player " + data.data.player_id.toString() + " caught cheating.")
+ }
+ break;
default:
console.log("received unknown data:",data);
diff --git a/public_html/js/phone.js b/public_html/js/phone.js
index cb915cd..8e2e384 100644
--- a/public_html/js/phone.js
+++ b/public_html/js/phone.js
@@ -1,6 +1,6 @@
class Phone{
constructor(){
- this.position = 0;
+ this.position = 0; //0: hidden 1: visible 2: notification
this.messages = [];
this.name = document.getElementById("TitlePage");
@@ -38,6 +38,10 @@ class Phone{
document.getElementById("appli-goo").addEventListener("click", (e) => {
this.webviewName = "Gogole"
this.changeWindow("https://mrdoob.com/projects/chromeexperiments/google-space/")
+ });
+ document.getElementById("appli-lest").addEventListener("click", (e) => {
+ this.webviewName = "Lester"
+ this.changeWindow("assets/phone/webview/lester.html")
});
}
@@ -99,10 +103,20 @@ class Phone{
this.contentmsg.appendChild(msg);
this.contentmsg.scrollTop = this.contentmsg.scrollHeight;
+
+ //notification
+ if(message.playerId!=player.id){
+ notificationSound.play();
+ if(this.position == 0){
+ this.position = 2;
+ document.getElementById("phoneContainer").className = "notification";
+ }
+ }
}
sendMessage(title, content){
let message = {
+ playerId: player.id,
title: player.name,
content: content
}
@@ -122,7 +136,7 @@ class Phone{
changePosition(){
if(!document.getElementById("phoneContainer").contains(document.activeElement)){
- if(this.position == 0){
+ if(this.position == 0 || this.position == 2){
document.getElementById("phoneContainer").className = "visible";
this.position = 1;
}else{
diff --git a/public_html/js/render.js b/public_html/js/render.js
index 26d25ba..674edfe 100644
--- a/public_html/js/render.js
+++ b/public_html/js/render.js
@@ -1,4 +1,4 @@
-let drawPortals = true;
+let drawPortals = false;
let drawCollisions = false;
const imgPlayer = new Image();
@@ -11,8 +11,17 @@ const map0_night = new Image();
const map1 = new Image();
const map2 = new Image();
const map3 = new Image();
+const map4 = new Image();
+const map5 = new Image();
+const map6 = new Image();
+const map7 = new Image();
+const map8 = new Image();
+const map9 = new Image();
+const map10 = new Image();
+const map11 = new Image();
const orange_portal = new Image();
const blue_portal = new Image();
+const portal = new Image();
imgPlayer.src = "./assets/body.png";
imgBullet.src = "./assets/bullet2.png";
imgCar.src = "./assets/car.png";
@@ -23,16 +32,26 @@ map0_night.src = "./assets/map/map_principale_nuit.png"
map1.src = "./assets/map/map1.png";
map2.src = "./assets/map/map2.png";
map3.src = "./assets/map/map3.png";
+map4.src = "./assets/map/map4.png";
+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";
+map10.src = "./assets/map/map10.jpg";
+map11.src = "./assets/map/map11.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];
+const mapImages = [map0,map1,map2,map3, map4, map5, map6, map7, map8, map9, map10, map11];
class Render {
constructor(idCanvas) {
let canvas = document.getElementById(idCanvas);
this.ctx = canvas.getContext("2d");
this.ctx.imageSmoothingEnabled=false;//does not lerp pixels
+ this.timer=0
}
RenderPlayer(p,isClient) {
@@ -96,17 +115,30 @@ class Render {
}
}
- RenderPortal(x,y,orange)
+ RenderPortalDebug(x,y,debug)
{
this.ctx.save();
this.ctx.translate(x,y);
- if(orange)
+ if(debug) {
this.ctx.drawImage(orange_portal,0,0,portalSize,portalSize);
- else
+ } else {
this.ctx.drawImage(blue_portal,0,0,portalSize,portalSize);
+ }
this.ctx.restore();
}
+ RenderPortal(x,y)
+ {
+ this.ctx.save();
+ this.ctx.translate(x+portalSize/2, y+portalSize/2);
+ this.ctx.rotate(this.timer * Math.PI / 180);
+ this.ctx.globalAlpha = 0.5;
+ this.ctx.drawImage(portal, -portalSize / 2, -portalSize / 2, portalSize, portalSize);
+ this.ctx.globalAlpha = 1;
+ this.ctx.restore();
+ }
+
+
ReloadAff() {
let background;
@@ -121,14 +153,23 @@ class Render {
}
else
{
- background=mapImages[Math.min(player.z,3)];
+ background=mapImages[Math.min(player.z,11)];
}
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)
@@ -137,6 +178,27 @@ class Render {
this.ctx.fillStyle = "rgba(255, 0, 0, 0.5)";
this.ctx.fillRect(s.x,s.y,s.w,s.h);
});
+ maps[player.z].circles.forEach((s) => {
+ this.ctx.beginPath();
+ this.ctx.arc(s.x, s.y, s.r, 0, 3 * Math.PI);
+ this.ctx.fillStyle = "rgba(255, 0, 0, 0.5)";
+ this.ctx.fill();
+ this.ctx.stroke();
+ this.ctx.closePath();
+ });
+ //on draw le centre du joueur
+ this.ctx.beginPath();
+ this.ctx.fillStyle="blue"
+ this.ctx.arc(player.x, player.y, 3, 0, 2 * Math.PI);
+ this.ctx.fill();
+ this.ctx.closePath();
+ //on draw les collisions autour du joueur
+ this.ctx.beginPath();
+ this.ctx.strokeStyle="red"
+ this.ctx.arc(player.x, player.y, playerSize/2, 0, 2 * Math.PI);
+ this.ctx.lineWidth="2";
+ this.ctx.stroke();
+ this.ctx.closePath();
}
cars.forEach((car) => {
@@ -151,14 +213,23 @@ class Render {
PNJS.forEach((pnj)=>{
this.RenderPnj(pnj.x, pnj.y, pnj.z, (pnj.dir-1)*Math.PI/4, pnj.dir!=0);
})
- if(drawPortals)
- {
- portals.forEach((portal) => {
- if(portal.in.z==player.z)
- this.RenderPortal(portal.in.x,portal.in.y,true);
- if(portal.out.z==player.z)
- this.RenderPortal(portal.out.x,portal.out.y,false);
- });
+
+ this.timer=(this.timer+1)%360
+ portals.forEach((portal) => {
+ if(portal.in.z==player.z) {
+ this.RenderPortal(portal.in.x,portal.in.y)
+ }
+ if(portal.out.z==player.z && drawPortals){
+ 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;
}
}
}
diff --git a/public_html/js/sound.js b/public_html/js/sound.js
index 76ae72b..0d69d49 100644
--- a/public_html/js/sound.js
+++ b/public_html/js/sound.js
@@ -2,6 +2,7 @@ class Sound{
constructor(url){
this.sound = new Audio(url);
this.sound.type = "audio/mp3";
+ this.sound.volume = 0.2;
}
play(){
diff --git a/server/server.js b/server/server.js
index 72c8580..e8b9f80 100644
--- a/server/server.js
+++ b/server/server.js
@@ -5,7 +5,6 @@ const fs = require('fs');
const objectsModule = require('./objects');
-
const options = {
cert: fs.readFileSync("/home/ubuntu/servers/keys/gta6/cert.pem"),
key: fs.readFileSync("/home/ubuntu/servers/keys/gta6/privkey.pem")
@@ -23,8 +22,9 @@ const wss = new WebSocket.Server({
const spawnPoints = [{"x":218,"y":193},{"x":601,"y":715},{"x":1264,"y":57},{"x":274,"y":506},{"x":921,"y":854},{"x":1041,"y":442},{"x":638,"y":124},{"x":483,"y":436}]
const connections = new Set();
-var playerCount = 0;
-var players = []
+let playerCount = 0;
+let players = []
+const MAX_HEALTH = 10;
const NAME_MAXLEN = 25;
@@ -52,6 +52,7 @@ function createNewPlayer(socket, name) {
id: playerCount,
x: pos[0],
y: pos[1],
+ z: 0,
dir: 0,
visibleDir: 0,
name: name
@@ -76,10 +77,28 @@ function createNewPlayer(socket, name) {
connections.add(socket);
}
+function kick_player(player_id, socket, reason){
+ //send cheating info to all players
+ broadcast(JSON.stringify({
+ type: "kick",
+ data: {
+ player_id: player_id,
+ reason: reason
+ }
+ }));
+ deletePlayer(socket); //delete player of players list
+ socket.terminate(); //disconnect cheating player
+}
+
function update(message, socket){
for (var i = players.length - 1; i >= 0; i--) {
- if (players[i].id == message.data.id) {
- players[i] = message.data;
+ if(message.data.health <= MAX_HEALTH) {
+ if (players[i].id == message.data.id) {
+ players[i] = message.data;
+ }
+ }else{
+ //cheat detected
+ kick_player(message.data.id, socket, "health cheat");
}
}
broadcast(JSON.stringify(message), socket.id);
@@ -97,6 +116,7 @@ function died(message, socket){
let pos = generatePosition();
players[i].x = pos[0];
players[i].y = pos[1];
+ players[i].z = 0;
broadcast(JSON.stringify({
type: "update",
diff --git a/tools/collidesTool/app.js b/tools/collidesTool/app.js
index 5f276da..4ef341c 100644
--- a/tools/collidesTool/app.js
+++ b/tools/collidesTool/app.js
@@ -2,7 +2,7 @@ var ctx = document.getElementById("canvas").getContext("2d");
var cv = document.getElementById("canvas");
const fond = new Image();
-fond.src = "../../public_html/assets/map/map_principale.png";
+fond.src = "../../public_html/assets/map/map11.jpg";
var mapWidth = fond.width
var mapHeith = fond.height
ctx.canvas.width = mapWidth
diff --git a/tools/parsing_json.html b/tools/parsing_json.html
new file mode 100644
index 0000000..9e04807
--- /dev/null
+++ b/tools/parsing_json.html
@@ -0,0 +1,51 @@
+
+
+
+
+
+ Conversion json to js let
+
+
+
+ Conversion json to js let
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Résultat :
+
+
+