Skip to content

Commit c86cd0a

Browse files
committed
Gravity is off ,perfectly working version
1 parent 91631c7 commit c86cd0a

File tree

1 file changed

+10
-10
lines changed
  • projects/color-constellation

1 file changed

+10
-10
lines changed

projects/color-constellation/main.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const gameState = {
88
selectedStar: null,
99
targetRequired: 0,
1010
gravity: { x: 0, y: 0.02 },
11-
gravityEnabled: true,
11+
gravityEnabled: false,
1212
hintUsed: false
1313
};
1414

@@ -66,28 +66,28 @@ class Star {
6666

6767
update() {
6868
if (gameState.gravityEnabled) {
69-
// Apply gravity
70-
this.vy += gameState.gravity.y;
71-
this.vx += gameState.gravity.x;
69+
// Apply much gentler gravity
70+
this.vy += gameState.gravity.y * 0.5;
71+
this.vx += gameState.gravity.x * 0.5;
7272

7373
// Apply velocity with damping
7474
this.x += this.vx;
7575
this.y += this.vy;
7676

77-
// Bounce off walls
77+
// Bounce off walls with strong damping
7878
if (this.x - this.radius < 0 || this.x + this.radius > canvas.width) {
79-
this.vx *= -0.8;
79+
this.vx *= -0.3;
8080
this.x = Math.max(this.radius, Math.min(canvas.width - this.radius, this.x));
8181
}
8282

8383
if (this.y - this.radius < 0 || this.y + this.radius > canvas.height) {
84-
this.vy *= -0.8;
84+
this.vy *= -0.3;
8585
this.y = Math.max(this.radius, Math.min(canvas.height - this.radius, this.y));
8686
}
8787

88-
// Apply friction
89-
this.vx *= 0.99;
90-
this.vy *= 0.99;
88+
// Apply strong friction to slow down quickly
89+
this.vx *= 0.95;
90+
this.vy *= 0.95;
9191
}
9292

9393
// Animate glow

0 commit comments

Comments
 (0)