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

Hadouken Sound #23

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
body {

background-color: #000;
}

.main {

background-color: white;
margin-top: 110px;
padding-left: 100px;
min-width: 1200px;
height: 500px;
position: relative;
z-index: 1;
}

.ryu,
.hadouken {

float: left;
}

.ryu {

width: 659px;
height: 494px;
}

.ryu-still,
.ryu-ready,
.ryu-throwing,
.ryu-cool {

width: 659px;
height: 494px;
display: block;
}

.ryu-ready,
.ryu-throwing,
.ryu-cool {

display: none;
}

.ryu-still {
background-image: url('../images/ryu-standing-still.png');
}

.ryu-ready {
background-image: url('../images/ryu-ready-position.gif');
}

.ryu-throwing {
background-image: url('../images/ryu-throwing-hadouken.png');
}

.ryu-cool {
background-image: url('../images/ryu-cool.gif');
}

.hadouken,
.ryu-still,
.ryu-ready,
.ryu-throwing,
.ryu-cool {

background-repeat: no-repeat;
}

.hadouken {

background-image: url('../images/hadouken.gif');
width: 156px;
height: 90px;
display: none;
float: left;
position: absolute;
z-index: 10;
top:174px;
left:520px;
}

.instructions {

text-align: center;
padding-top: 100px;
padding-left: 20px;
padding-right: 20px;
}
24 changes: 22 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>Streetfighter</title>
<meta name="description" content="The Street Fighter Game made with jQuery to animate the charachter Ryuman with hadouken and sounds">

<title>Street Fighter</title>

<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">

</head>

<body>

<div class="main">
<div class="ryu">
<div class="ryu-still"></div>
<div class="ryu-ready"></div>
<div class="ryu-throwing"></div>
<div class="ryu-cool"></div>
</div>
<div class="hadouken"></div>
<div class="instructions">
<h1>Click on Ryu to make him throw Hadouken</h1>
<h1>Press 'X' key to make him stand in cool pose</h1>
</div>
</div>
<audio id="hadouken-sound" src="sound/hadouken.mp3">
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="js/app.js"></script>
</body>

</html>
53 changes: 53 additions & 0 deletions js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
$(document).ready(function(){

//globalizing the key
var key = '0';
$('.ryu').mouseenter(function(){
$('.ryu-still').hide();
$('.ryu-ready').show();
})
.mouseleave(function(){
$('.ryu-ready').hide();
$('.ryu-still').show();
})
.mousedown(function(){
playHadouken();
$('.ryu-ready').hide();
$('.ryu-throwing').show();
$('.hadouken').finish().show().animate(
{'left': '1020px'},
500,
function(){
$('.hadouken').hide();
$('.hadouken').css('left','520px');
}
);
})
.mouseup(function(){
$('.ryu-throwing').hide();
$('.ryu-ready').show();
})
$(document).keydown( function(event){
key = (event.keyCode ? event.keyCode : event.which);
if (key == '88')
{
$('.ryu-still').hide();
$('.ryu-ready').hide();
$('.ryu-throwing').hide();
$('.ryu-cool').show();
}
})
.keyup(function(){
if (key == '88')
{
$('.ryu-cool').hide();
$('.ryu-still').show();
}
});
});

function playHadouken () {
$('#hadouken-sound')[0].volume = 0.5;
$('#hadouken-sound')[0].load();
$('#hadouken-sound')[0].play();
}