mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-20 12:15:06 -04:00
Wind perk
This commit is contained in:
parent
43e5e76666
commit
6d1cbddf95
2 changed files with 125 additions and 10 deletions
|
@ -337,10 +337,10 @@ function getLevelStats() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function pickedUpgradesHTMl() {
|
function pickedUpgradesHTMl() {
|
||||||
let list=''
|
let list = ''
|
||||||
for(let u of upgrades){
|
for (let u of upgrades) {
|
||||||
for(let i=0;i< perks[u.id];i++)
|
for (let i = 0; i < perks[u.id]; i++)
|
||||||
list+=u.icon+' '
|
list += u.icon + ' '
|
||||||
}
|
}
|
||||||
|
|
||||||
return list
|
return list
|
||||||
|
@ -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.",
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -706,7 +713,7 @@ function getUpgraderUnlockPoints() {
|
||||||
|
|
||||||
let lastOffered = {}
|
let lastOffered = {}
|
||||||
|
|
||||||
function dontOfferTooSoon(id){
|
function dontOfferTooSoon(id) {
|
||||||
lastOffered[id] = Math.round(Date.now() / 1000)
|
lastOffered[id] = Math.round(Date.now() / 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,7 +766,7 @@ function restart() {
|
||||||
const randomGift = reset_perks();
|
const randomGift = reset_perks();
|
||||||
|
|
||||||
incrementRunStatistics('starting_upgrade.' + randomGift, 1)
|
incrementRunStatistics('starting_upgrade.' + randomGift, 1)
|
||||||
dontOfferTooSoon(randomGift)
|
dontOfferTooSoon(randomGift)
|
||||||
|
|
||||||
setLevel(0);
|
setLevel(0);
|
||||||
scoreStory.push(`You started playing with the upgrade "${upgrades.find(u => u.id === randomGift)?.name}" on the level "${runLevels[0].name}". `,);
|
scoreStory.push(`You started playing with the upgrade "${upgrades.find(u => u.id === randomGift)?.name}" on the level "${runLevels[0].name}". `,);
|
||||||
|
@ -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;
|
||||||
|
@ -1086,7 +1119,7 @@ function ballTick(ball, delta) {
|
||||||
attract(ball, b2, perks.ball_attract_ball)
|
attract(ball, b2, perks.ball_attract_ball)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (perks.puck_repulse_ball && Math.abs(ball.x-puck)<puckWidth/2+ballSize*(9+perks.puck_repulse_ball)/10) {
|
if (perks.puck_repulse_ball && Math.abs(ball.x - puck) < puckWidth / 2 + ballSize * (9 + perks.puck_repulse_ball) / 10) {
|
||||||
repulse(ball, {
|
repulse(ball, {
|
||||||
x: puck,
|
x: puck,
|
||||||
y: gameZoneHeight,
|
y: gameZoneHeight,
|
||||||
|
@ -1122,7 +1155,7 @@ function ballTick(ball, delta) {
|
||||||
if (!ball.hitSinceBounce) {
|
if (!ball.hitSinceBounce) {
|
||||||
incrementRunStatistics('miss')
|
incrementRunStatistics('miss')
|
||||||
levelMisses++;
|
levelMisses++;
|
||||||
const loss=resetCombo(ball.x,ball.y)
|
const loss = resetCombo(ball.x, ball.y)
|
||||||
//
|
//
|
||||||
// flashes.push({
|
// flashes.push({
|
||||||
// type: "text",
|
// type: "text",
|
||||||
|
@ -1134,7 +1167,7 @@ function ballTick(ball, delta) {
|
||||||
// duration: 450,
|
// duration: 450,
|
||||||
// size: puckHeight,
|
// size: puckHeight,
|
||||||
// })
|
// })
|
||||||
if (ball.bouncesList?.length ) {
|
if (ball.bouncesList?.length) {
|
||||||
ball.bouncesList.push({
|
ball.bouncesList.push({
|
||||||
x: ball.previousx,
|
x: ball.previousx,
|
||||||
y: ball.previousy
|
y: ball.previousy
|
||||||
|
@ -1153,7 +1186,7 @@ function ballTick(ball, delta) {
|
||||||
ethereal: true,
|
ethereal: true,
|
||||||
time: levelTime,
|
time: levelTime,
|
||||||
size: coinSize / 2,
|
size: coinSize / 2,
|
||||||
color: loss?'red':ball.color,
|
color: loss ? 'red' : ball.color,
|
||||||
x: start.x + (i / (parts - 1)) * (end.x - start.x),
|
x: start.x + (i / (parts - 1)) * (end.x - start.x),
|
||||||
y: start.y + (i / (parts - 1)) * (end.y - start.y),
|
y: start.y + (i / (parts - 1)) * (end.y - start.y),
|
||||||
vx: (Math.random() - 0.5) * baseSpeed,
|
vx: (Math.random() - 0.5) * baseSpeed,
|
||||||
|
|
|
@ -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": ""
|
||||||
}
|
}
|
||||||
]
|
]
|
Loading…
Add table
Add a link
Reference in a new issue