Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sound.ts added #13

Merged
merged 3 commits into from
Oct 30, 2023
Merged

sound.ts added #13

merged 3 commits into from
Oct 30, 2023

Conversation

Vidhanvyrs
Copy link
Contributor

No description provided.

@netlify
Copy link

netlify bot commented Oct 30, 2023

Deploy Preview for skyscraper-game ready!

Name Link
🔨 Latest commit 0cb231a
🔍 Latest deploy log https://app.netlify.com/sites/skyscraper-game/deploys/653fb2b0a5a6e700086bbb98
😎 Deploy Preview https://deploy-preview-13--skyscraper-game.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Owner

@corners2wall corners2wall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep going

Comment on lines 30 to 36
this.audio.addEventListener('ended', () => {
if (count > 1) {
count--;
this.audio.currentTime = 0;
this.audio.play();
}
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this function into private method decreaseCounter

Comment on lines 44 to 55

// usage:
const tapBlockSound = new Sound('public/sound/tapBlock.wav');
const gameOverSound = new Sound('public/sound/gameOverSound.wav');

// To play the sounds:
tapBlockSound.play();
gameOverSound.play();


tapBlockSound.setVolume(0.5);
gameOverSound.repeat(2);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this

Comment on lines 2 to 7
interface Sound {
play(): void; // play sound
stop(): void; // stop sound
repeat(count: number): void; // repeat sound `count` times or infinity
setVolume(value: number): void; // set volume of sound
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove comments from interface
Rename interface to ISound

setVolume(value: number): void; // set volume of sound
}

class Sound implements Sound {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to

export default class Sound implements ISound {

repeat(count: number) {
if (count === Infinity) {
this.audio.loop = true;
} else if (count > 0) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better:

if (count > 0) {

@Vidhanvyrs
Copy link
Contributor Author

on it @corners2wall

@corners2wall
Copy link
Owner

@Vidhanvyrs Good job!!!

@corners2wall corners2wall merged commit f24e1c1 into corners2wall:main Oct 30, 2023
4 checks passed
@Vidhanvyrs
Copy link
Contributor Author

@Vidhanvyrs Good job!!!

Thankyou 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants