balls: removing cookies support

This commit is contained in:
Sheldan
2025-08-08 19:22:11 +02:00
parent 5ca9e00286
commit eb7e98b384
3 changed files with 2 additions and 217 deletions

View File

@@ -12,7 +12,7 @@
"canvas-common": "file:../canvas-common"
},
"devDependencies": {
"vite": "5.2.7"
"vite": "^5.1.5"
}
},
"../canvas-common": {

View File

@@ -360,22 +360,9 @@ function rectsAct(){
config.balls.balls++;
toSpawn = config.balls.balls;
spawnStuff();
updateCookieStorage();
spawning = false;
}
function updateCookieStorage(){
var objectToStore = {
rects: rects,
balls: config.balls.balls,
buffs: buffs,
portals: portals
};
Cookies.remove('balls');
Cookies.set('balls', objectToStore);
}
function paintBalls(){
balls.forEach(paintBall)
}
@@ -817,35 +804,7 @@ docReady(function () {
y: touchEvent.touches[0].clientY - rect.top
};
}
var possibleBalls = Cookies.getJSON('balls');
if(possibleBalls == undefined){
spawnStuff();
} else {
buffs = possibleBalls.buffs;
portals = possibleBalls.portals;
rects = possibleBalls.rects;
// it doesnt store functions
buffs.forEach(function(buff){
buff.effect = function(ball) {
reboundBalls += buff.duration;
}
});
portals.forEach(function(portal){
portal.source.effect = function(ball) {
collisionWithPortal(ball, portal.source, portal.target);
};
//blue
portal.target.effect = function(ball) {
collisionWithPortal(ball, portal.target, portal.source);
};
});
config.balls.balls = possibleBalls.balls;
}
spawnStuff();
requestAnimationFrame(updateCanvas);
setInterval(function(){