mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-21 20:46:14 -04:00
Try to get the horizontally bouncing balls unstuck, and allow ball to go fast when tethered
This commit is contained in:
parent
dc73290fb2
commit
c89aca7a11
1 changed files with 14 additions and 9 deletions
|
@ -1326,21 +1326,26 @@ function ballTick(ball, delta) {
|
|||
ball.previousvx = ball.vx;
|
||||
ball.previousvy = ball.vy;
|
||||
|
||||
if (isTelekinesisActive(ball)) {
|
||||
ball.vx += ((puck - ball.x) / 1000) * delta * perks.telekinesis;
|
||||
}
|
||||
|
||||
const speedLimitDampener = 1 + perks.telekinesis + perks.ball_repulse_ball + perks.puck_repulse_ball + perks.ball_attract_ball
|
||||
if (ball.vx * ball.vx + ball.vy * ball.vy < baseSpeed * baseSpeed * 2) {
|
||||
ball.vx *= (1 + .02 / speedLimitDampener);
|
||||
ball.vy *= (1 + .02 / speedLimitDampener);
|
||||
} else {
|
||||
ball.vx *= (1 - .02 / speedLimitDampener);
|
||||
if (Math.abs(ball.vy) > 0.5 * baseSpeed) {
|
||||
if (isTelekinesisActive(ball)) {
|
||||
ball.vx += ((puck - ball.x) / 1000) * delta * perks.telekinesis;
|
||||
}else{
|
||||
if (ball.vx * ball.vx + ball.vy * ball.vy < baseSpeed * baseSpeed * 2) {
|
||||
ball.vx *= (1 + .02 / speedLimitDampener);
|
||||
ball.vy *= (1 + .02 / speedLimitDampener);
|
||||
} else {
|
||||
ball.vx *= (1 - .02 / speedLimitDampener);
|
||||
ball.vy *= (1 - .02 / speedLimitDampener);
|
||||
}
|
||||
}
|
||||
|
||||
if(Math.abs(ball.vy) < 0.2*baseSpeed){
|
||||
ball.vy+= .02 / speedLimitDampener
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (perks.ball_repulse_ball) {
|
||||
for (b2 of balls) {
|
||||
// avoid computing this twice, and repulsing itself
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue