data endpoint for entity 90008 (aka. a website)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add ground friction

dusk b85d1605 e248213c

+4 -2
+4 -2
src/components/pet.svelte
··· 66 66 let velocityY = 0; 67 67 let gravity = 200.0; // Gravity strength (positive because -Y is up) 68 68 let friction = 0.96; // Air friction 69 + let groundFriction = 0.9; // Ground friction 69 70 let bounciness = 0.8; // How much energy is preserved on bounce 70 71 71 72 const move = () => { ··· 79 80 velocityY += gravity * delta; 80 81 81 82 // Apply friction 82 - velocityX *= friction; 83 - velocityY *= friction; 83 + const fric = position.y === 0 ? groundFriction : friction; 84 + velocityX *= fric; 85 + velocityY *= fric; 84 86 85 87 // Update position 86 88 position.x += velocityX * delta;