Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/hamin/YourFace
Browse files Browse the repository at this point in the history
Conflicts:
	index.html
  • Loading branch information
ribeto committed Jun 26, 2011
2 parents ab5fefe + 19e5053 commit d65dd6f
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 2 deletions.
Binary file added assets/logo.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions css/master.css
Expand Up @@ -7,6 +7,12 @@ body{ overflow: hidden;}
background-color: black;
width: 700px;
height: 900px;
float:left;
}

#rightCol {
float:right;
margin-right:150px;
}

.me {
Expand Down Expand Up @@ -56,4 +62,14 @@ body{ overflow: hidden;}
display: inline-block;
width: 50px;
height: 50px;
}

.hit {
background-color: blue;
border-color: black;
border-width: 1px;
border-style: solid;
border-radius: 15px;
width: 33px;
height: 33px;
}
13 changes: 13 additions & 0 deletions index.html
Expand Up @@ -13,5 +13,18 @@
<body>
<div id="playingField" class="playingField">
</div>
<div id="rightCol">
<div id="title">
<h1>$!@& Your Face!</h1>
<img src="/assets/logo.jpeg" alt="$!@& Your Face!" />
</div>
<div id="score">
<h2>My Score</h2>
<div id="myScore"></div>

<h2>Opponent Score</h2>
<div id="oppScore"></div>
</div>
</div>
</body>
</html>
17 changes: 17 additions & 0 deletions public/client.coffee
Expand Up @@ -6,6 +6,9 @@ session = null
clientId = -1
bullets = []
bulletNum = 0
myScore = 0
oppScore = 0
hits=0

addHandler = (session,type,callback) ->
console.log "addHandler"
Expand Down Expand Up @@ -72,13 +75,27 @@ shoot = (position, isOpp) ->

if $("##{bulletName}").offset().left in [oppLeft..oppWidth]
console.log("BOOM!!!!")
if isOpp == true then (oppScore += 1) else (myScore += 1)
$('#myScore').html "<h3>#{myScore}</h3>"
$('#oppScore').html "<h3>#{oppScore}</h3>"
# add explosion
explosionClass = "explosionBlue"
explosionClass = "explosion" if isOpp is true
$("#playingField").append "<div id='explosion' class='#{explosionClass}'></div>"
top = oppTop;
top = meTop if isOpp is true
$("#explosion").offset left: oppLeft+50, top: top+50
setTimeout "$(\"#explosion\").remove()", 250
# add hit

hitName = "h#{hits}"
$(".opponent").append "<div id='#{hitName}' class='hit'></div>"
$("##{hitName}").offset left: (hits%3) * 30 + 20, top: (Math.floor hits/3) * 30 + 20
++hits;

console.log $("##{hitName}").offset()

alert "Game OVER!!!" if hits is 9

# If it leaves playing field remove the bullet
if ( isOpp is true && $("##{bulletName}").offset().top > 800 ) or ( isOpp is false && $("##{bulletName}").offset().top < 8 )
Expand Down
25 changes: 23 additions & 2 deletions public/client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d65dd6f

Please sign in to comment.