Skip to content

Commit

Permalink
increased movement speed
Browse files Browse the repository at this point in the history
  • Loading branch information
jellinki committed Oct 23, 2023
1 parent 09f1974 commit dacc68b
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions _posts/2023-10-12-teamwork.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ courses: { compsci: {week: 7} }
let isMovingRight = false;
let isIdle = true;

const gravity = 0.5;
const jumpStrength = -10;
const moveSpeed = 8;
const gravity = 0.7; // Increased gravity for faster fall
const jumpStrength = -15; // Increased jump strength for higher jumps
const moveSpeed = 15; // Increased move speed

function updateSpriteAnimation() {
if (frameX < maxFrame) {
Expand Down Expand Up @@ -120,8 +120,6 @@ courses: { compsci: {week: 7} }

var platforms = [];

const jumpStrength = -10;

function generateRandomPlatform() {
var platform = {
width: 150,
Expand All @@ -147,15 +145,13 @@ courses: { compsci: {week: 7} }
setInterval(generateRandomPlatform, 1200);

function checkCollisions() {
// Check collisions between the sprite and platforms
platforms.forEach(function (platform) {
if (
spriteX + spriteWidth > platform.x &&
spriteX < platform.x + platform.width &&
spriteY + spriteHeight > platform.y &&
spriteY < platform.y
) {
// Collision detected, set the sprite on the platform
spriteY = platform.y - spriteHeight;
isJumping = false;
spriteVelocityY = 0;
Expand Down

0 comments on commit dacc68b

Please sign in to comment.