aboutsummaryrefslogtreecommitdiff
path: root/race
diff options
context:
space:
mode:
authorMinteck <nekostarfan@gmail.com>2021-06-05 21:03:47 +0200
committerMinteck <nekostarfan@gmail.com>2021-06-05 21:03:47 +0200
commit4ec6f33be6130705b81f19fdc9e2fe01b4a3e7e2 (patch)
tree5b302015939c129ea7fdffc9560fdd89e2547039 /race
parent97ebd65491420363f74ae9e5e6bf77495a37172f (diff)
downloadkartik-client-4ec6f33be6130705b81f19fdc9e2fe01b4a3e7e2.tar.gz
kartik-client-4ec6f33be6130705b81f19fdc9e2fe01b4a3e7e2.tar.bz2
kartik-client-4ec6f33be6130705b81f19fdc9e2fe01b4a3e7e2.zip
Stats presque fini
Diffstat (limited to 'race')
-rw-r--r--race/cars/car0.js4
-rw-r--r--race/cars/car1.js1
-rw-r--r--race/cars/keymap.js4
3 files changed, 9 insertions, 0 deletions
diff --git a/race/cars/car0.js b/race/cars/car0.js
index ddfe8c5..ad1c227 100644
--- a/race/cars/car0.js
+++ b/race/cars/car0.js
@@ -54,6 +54,7 @@ startHooks.push(() => {
Sound.crash()
document.getElementById("car0").style.left = car0startx + "px";
document.getElementById("car0").style.top = car0starty + "px";
+ require('electron').ipcRenderer.send('addstats', { catalog: "ingame", key: "walls", add: 1 });
Array.from(document.getElementById('oil').children).forEach((item) => {
spreadOil(item);
})
@@ -96,6 +97,7 @@ startHooks.push(() => {
} else {
Sound.last()
}
+ require('electron').ipcRenderer.send('addstats', { catalog: "ingame", key: "laps", add: 1 });
document.getElementById('laps-car0').innerText = (document.getElementById('laps-car0').innerText.split("/")[0] - 1 + 2).toString();
if (location.search === "?sp") {
if ((document.getElementById('laps-car0').innerText.split("/")[0] - 1 + 1) > (document.getElementById('laps-car1').innerText.split("/")[0] - 1 + 1)) {
@@ -106,6 +108,7 @@ startHooks.push(() => {
}
} else {
info("CarManager:car0", "Car won the game");
+ require('electron').ipcRenderer.send('addstats', { catalog: "results", key: "wins", add: 1 });
if (location.search === "?sp") {
scenar("won1", "sad");
}
@@ -156,6 +159,7 @@ startHooks.push(() => {
scenar("wall1", "happy");
}
Sound.crash();
+ require('electron').ipcRenderer.send('addstats', { catalog: "ingame", key: "walls", add: 1 });
document.getElementById("car0").style.left = car0startx + "px";
document.getElementById("car0").style.top = car0starty + "px";
Array.from(document.getElementById('oil').children).forEach((item) => {
diff --git a/race/cars/car1.js b/race/cars/car1.js
index 750cbb3..0c4c9f0 100644
--- a/race/cars/car1.js
+++ b/race/cars/car1.js
@@ -113,6 +113,7 @@ startHooks.push(() => {
if (location.search === "?sp") {
scenar("won2", "happy");
}
+ require('electron').ipcRenderer.send('addstats', { catalog: "results", key: "loses", add: 1 });
try { document.getElementById('music').src = "about:blank"; } catch (e) { console.error(e); }
Sound.win();
keysEnabled = false;
diff --git a/race/cars/keymap.js b/race/cars/keymap.js
index 74cce0a..221a7ec 100644
--- a/race/cars/keymap.js
+++ b/race/cars/keymap.js
@@ -29,6 +29,7 @@ startHooks.push(() => {
car0cspeed = car0cspeed + 0.2;
}
if (document.getElementById("car0").style.transform !== "rotate(-90deg)") {
+ require('electron').ipcRenderer.send('addstats', { catalog: "ingame", key: "turns", add: 1 });
document.getElementById("car0").style.transform = "rotate(-90deg)";
car0collisionon = false;
setTimeout(() => {
@@ -41,6 +42,7 @@ startHooks.push(() => {
car0cspeed = car0cspeed + 0.2;
}
if (document.getElementById("car0").style.transform !== "rotate(90deg)") {
+ require('electron').ipcRenderer.send('addstats', { catalog: "ingame", key: "turns", add: 1 });
document.getElementById("car0").style.transform = "rotate(90deg)";
car0collisionon = false;
setTimeout(() => {
@@ -53,6 +55,7 @@ startHooks.push(() => {
car0cspeed = car0cspeed + 0.2;
}
if (document.getElementById("car0").style.transform !== "rotate(180deg)") {
+ require('electron').ipcRenderer.send('addstats', { catalog: "ingame", key: "turns", add: 1 });
document.getElementById("car0").style.transform = "rotate(180deg)";
car0collisionon = false;
setTimeout(() => {
@@ -65,6 +68,7 @@ startHooks.push(() => {
car0cspeed = car0cspeed + 0.2;
}
if (document.getElementById("car0").style.transform !== "rotate(0deg)") {
+ require('electron').ipcRenderer.send('addstats', { catalog: "ingame", key: "turns", add: 1 });
document.getElementById("car0").style.transform = "rotate(0deg)";
car0collisionon = false;
setTimeout(() => {