Skip to content

Commit 42632d8

Browse files
committed
rotace fixnutá
1 parent 95cece8 commit 42632d8

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

static/kvh/app.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,35 +153,38 @@ function updatePhysics() {
153153
continue;
154154
}
155155

156-
data.vy += 0.2;
156+
//data.vy += 0.2;
157157

158158
data.x += data.vx;
159159
data.y += data.vy;
160160
data.r += data.vr;
161161

162-
const maxSpin = 3; // Increased from 1 to allow more dramatic spinning
163-
if (data.vr > maxSpin) data.vr = maxSpin;
164-
if (data.vr < -maxSpin) data.vr = -maxSpin;
162+
const maxSpin = 3;
163+
if (data.r > maxSpin) data.r = maxSpin;
164+
if (data.r < -maxSpin) data.r = -maxSpin;
165165

166166
const centerX = data.x + data.radius;
167167
const centerY = data.y + data.radius;
168168

169+
const high_update = 1.05;
170+
const low_update = 0.97;
171+
169172
// Simple wall collision with spin effects
170173
if (centerX - data.radius <= 0 || centerX + data.radius >= viewport.width) {
171174
const bounceIntensity = Math.abs(data.vx) / 10;
172175
playCollisionSound(bounceIntensity);
173-
data.vx *= -0.9; // Lose energy on bounce
174-
data.vy += data.vr * 0.5; // Spin affects bounce direction
175-
data.vr *= 0.8; // Lose some spin
176+
data.vx *= -high_update;
177+
data.vy *= high_update;
178+
data.vr *= low_update;
176179
data.x = Math.max(0, Math.min(viewport.width - data.radius * 2, data.x));
177180
}
178181

179182
if (centerY - data.radius <= 0 || centerY + data.radius >= viewport.height) {
180183
const bounceIntensity = Math.abs(data.vy) / 10;
181184
playCollisionSound(bounceIntensity);
182-
data.vy *= -0.9; // Lose energy on bounce
183-
data.vx += data.vr * 0.5; // Spin affects bounce direction
184-
data.vr *= 0.8; // Lose some spin
185+
data.vy *= -high_update;
186+
data.vx *= high_update;
187+
data.vr *= low_update;
185188
data.y = Math.max(0, Math.min(viewport.height - data.radius * 2, data.y));
186189
}
187190

0 commit comments

Comments
 (0)