Wind perk

This commit is contained in:
Renan LE CARO 2025-02-19 22:06:29 +01:00
parent 43e5e76666
commit 6d1cbddf95
2 changed files with 125 additions and 10 deletions

View file

@ -648,6 +648,13 @@ const upgrades = [
"max": 3, "max": 3,
"help": "Puck repulses balls.", "help": "Puck repulses balls.",
}, },
{
"threshold": 35000,
"id": "wind",
"name": "Wind",
"max": 3,
"help": "Puck position creates wind.",
},
] ]
@ -904,6 +911,10 @@ function bordersHitCheck(coin, radius, delta) {
coin.sx *= 0.9; coin.sx *= 0.9;
coin.sy *= 0.9; coin.sy *= 0.9;
if (perks.wind) {
coin.vx += (puck - (offsetX + gameZoneWidth / 2)) / gameZoneWidth * perks.wind * 0.5;
}
let vhit = 0, hhit = 0; let vhit = 0, hhit = 0;
@ -1026,6 +1037,28 @@ function tick() {
balls.forEach((ball) => ballTick(ball, delta)); balls.forEach((ball) => ballTick(ball, delta));
if (perks.wind) {
const windD = (puck - (offsetX + gameZoneWidth / 2)) / gameZoneWidth * 2 * perks.wind
for (var i = 0; i < perks.wind; i++) {
if(Math.random()*Math.abs(windD)>0.5) {
flashes.push({
type: "particle",
duration: 150,
ethereal: true,
time: levelTime,
size: coinSize / 2,
color: rainbowColor(),
x: offsetXRoundedDown+ Math.random() * gameZoneWidthRoundedUp ,
y: Math.random() * gameZoneHeight,
vx: windD*8,
vy: 0,
});
}
}
}
flashes.forEach((flash) => { flashes.forEach((flash) => {
if (flash.type === "particle") { if (flash.type === "particle") {
flash.x += flash.vx * delta; flash.x += flash.vx * delta;

View file

@ -9122,5 +9122,87 @@ let allLevels=[
"" ""
], ],
"svg": "" "svg": ""
},
{
"name": "perk:wind",
"size": 9,
"bricks": [
"",
"#E67070",
"#E67070",
"",
"",
"",
"",
"",
null,
"#E67070",
"",
"",
"",
"#E66BA8",
"#E66BA8",
"#E66BA8",
"#E66BA8",
null,
"#E67070",
"",
"",
"",
"",
"",
"",
"",
null,
"",
"#E67070",
"#E67070",
"#E67070",
"#E67070",
"#E67070",
"#E67070",
"#E67070",
null,
"",
"",
"",
"",
"",
"",
"",
"",
null,
"",
"#E67070",
"#E67070",
"#E67070",
"#E67070",
"#E67070",
"#E67070",
"#E67070",
null,
"#E67070",
"",
"",
"",
"",
"",
"",
"",
null,
"#E67070",
"",
"",
"",
"#E66BA8",
"#E66BA8",
"#E66BA8",
"#E66BA8",
null,
null,
"#E67070",
"#E67070"
],
"svg": ""
} }
] ]