Skip to content

Commit

Permalink
Add sound effect and animation for jumping
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstrands committed Mar 22, 2024
1 parent f92f637 commit 8fe27a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ async function main() {
kb.volume(0.5);

kb.loadSound("oof", "sounds/oof.mp3");
kb.loadSound("jump", "sounds/jump.wav");

kb.loadSprite("dodo", "sprites/Dodo_10x.png", {
sliceX: 4,
Expand Down Expand Up @@ -49,6 +50,7 @@ async function main() {
from: 0,
to: 1,
loop: true,
speed: 5,
},
},
});
Expand All @@ -74,7 +76,7 @@ async function main() {
let score = 0;
let time = 0;

kb.setGravity(800);
kb.setGravity(920);

const player = kb.add([
kb.sprite("dodo"),
Expand Down Expand Up @@ -157,6 +159,8 @@ async function main() {
player.doubleJump(JUMP_FORCE * 0.8);
player.play("jump");
}

kb.play("jump");
});

const scoreLabel = kb.add([
Expand Down
Binary file added www/sounds/jump.wav
Binary file not shown.

0 comments on commit 8fe27a6

Please sign in to comment.