-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
63 changed files
with
1,735 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# **Game_Name** | ||
|
||
Drum Kit [Issue #4876] | ||
|
||
<br> | ||
|
||
## **Description 📃** | ||
Drum kit game is developed using HTML, CSS, JavaScript. | ||
Main target is to have experience of drum kit sound and have fun. | ||
|
||
|
||
## **functionalities 🎮** | ||
1. Have experience of drum kit sound and have fun. | ||
<br> | ||
|
||
## **How to play? 🕹️** | ||
1. User can click on drum image. | ||
2. User can play using keyboard too. | ||
## **Screenshots 📸** | ||
![Drum_kit](./images/asset.png) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" dir="ltr"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>Drum Kit</title> | ||
<link rel="stylesheet" href="styles.css"> | ||
<link href="https://fonts.googleapis.com/css?family=Arvo" rel="stylesheet"> | ||
</head> | ||
|
||
<body> | ||
|
||
<h1 id="title">Drum 🥁 Kit</h1> | ||
<div class="set"> | ||
<button class="w drum">w</button> | ||
<button class="a drum">a</button> | ||
<button class="s drum">s</button> | ||
<button class="d drum">d</button> | ||
<button class="j drum">j</button> | ||
<button class="k drum">k</button> | ||
<button class="l drum">l</button> | ||
</div> | ||
|
||
<script src="index.js" charset="utf-8"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// document.querySelector("button").addEventListener("click" , handleClick); | ||
|
||
// function handleClick(){ | ||
// alert("I got clicked"); | ||
// } | ||
|
||
|
||
// SOUND EVENT ONLY | ||
|
||
// var noOfButtons = document.querySelectorAll(".drum").length ; | ||
// for(var i=0; i< noOfButtons ; i++){ | ||
// document.querySelectorAll(".drum")[i].addEventListener("click" , function(){ | ||
// var buttonInnerHTML = this.innerHTML; | ||
// switch(buttonInnerHTML){ | ||
// case "w" : | ||
// var tom1 = new Audio("sounds/tom-1.mp3"); | ||
// tom1.play(); | ||
// break; | ||
// case "a" : | ||
// var tom2 = new Audio("sounds/tom-2.mp3"); | ||
// tom2.play(); | ||
// break; | ||
// case "s" : | ||
// var tom3 = new Audio("sounds/tom-3.mp3"); | ||
// tom3.play(); | ||
// break; | ||
// case "d" : | ||
// var tom4 = new Audio("sounds/tom-4.mp3"); | ||
// tom4.play(); | ||
// break; | ||
// case "j" : | ||
// var snare = new Audio("sounds/snare.mp3"); | ||
// snare.play(); | ||
// case "k" : | ||
// var crash = new Audio("sounds/crash.mp3"); | ||
// crash.play(); | ||
// break; | ||
// case "l" : | ||
// var kick = new Audio("sounds/kick-bass.mp3"); | ||
// kick.play(); | ||
// break; | ||
// default : console.log(); | ||
// } | ||
// }); | ||
// } | ||
|
||
|
||
// DETECT BUTTON PRESS | ||
var noOfButtons = document.querySelectorAll(".drum").length ; | ||
for(var i=0; i< noOfButtons ; i++){ | ||
document.querySelectorAll(".drum")[i].addEventListener("click" , function(){ | ||
var buttonInnerHTML = this.innerHTML; | ||
makeSound(buttonInnerHTML); | ||
buttonAnimation(buttonInnerHTML); | ||
}); | ||
} | ||
// DETECT KEYBOARD PRESS | ||
document.addEventListener("keydown" , function(event){ | ||
makeSound(event.key); | ||
buttonAnimation(event.key); | ||
}); | ||
|
||
function makeSound(key){ | ||
switch(key){ | ||
case "w" : | ||
var tom1 = new Audio("sounds/tom-1.mp3"); | ||
tom1.play(); | ||
break; | ||
case "a" : | ||
var tom2 = new Audio("sounds/tom-2.mp3"); | ||
tom2.play(); | ||
break; | ||
case "s" : | ||
var tom3 = new Audio("sounds/tom-3.mp3"); | ||
tom3.play(); | ||
break; | ||
case "d" : | ||
var tom4 = new Audio("sounds/tom-4.mp3"); | ||
tom4.play(); | ||
break; | ||
case "j" : | ||
var snare = new Audio("sounds/snare.mp3"); | ||
snare.play(); | ||
case "k" : | ||
var crash = new Audio("sounds/crash.mp3"); | ||
crash.play(); | ||
break; | ||
case "l" : | ||
var kick = new Audio("sounds/kick-bass.mp3"); | ||
kick.play(); | ||
break; | ||
default : console.log(); | ||
} | ||
} | ||
|
||
function buttonAnimation(currentKey){ | ||
var active = document.querySelector("." + currentKey); | ||
active.classList.add("pressed"); | ||
|
||
setTimeout(function(){ | ||
active.classList.remove("pressed"); | ||
},100); | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.