Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixes

  • Loading branch information...
commit 4c8f9d3083a7da45c5b4f18d4e370b10afb6b98d 1 parent cda2cf6
@playerx playerx authored
View
8 Jok.Pitching/Jok.Pitching/Content/Site.css
@@ -1,12 +1,19 @@
html, body {
height: 100%;
background: black;
+ overflow: hidden;
}
img {
border: 0px;
}
+#Root {
+ width: 900px;
+margin-left: auto;
+margin-right: auto;
+}
+
#Container {
z-index: 200;
position: relative;
@@ -97,7 +104,6 @@ img {
bottom: 0px;
background: rgba(0, 0, 0, 0.54);
z-index: 300;
- display: none;
}
#Menu .start {
View
27 Jok.Pitching/Jok.Pitching/Scripts/Game.js
@@ -19,7 +19,7 @@ var Game = {
});
$(document).on('keydown', this.UIKeyDown);
- $(document).on('click', '#Container', this.UIFire);
+ //$(document).on('click', '#Container', this.UIFire);
$(document).on('click', '#StartGame', this.UIStartGame);
$(document).on('click', '#PlayAgain', this.UIPlayAgain);
$(document).on('click', '#Game .volume', this.UIToggleMusic);
@@ -166,7 +166,7 @@ var Game = {
$('#Game .user_avatar').attr('src', RootUrl + '/Images/user_avatar_hp_' + hp + '.png');
$('#Game .user_avatar').attr('data-hp', hp);
} else {
- clearInterval(_this.tomatoFireHandler);
+ clearTimeout(_this.tomatoFireHandler);
_this.finishGame(false);
}
}
@@ -222,15 +222,20 @@ var Game = {
newImg.src = RootUrl + 'Images/user_avatar_hp_' + this.userHP + '.png';
this.userImg.setImage(newImg);
- this.tomatoFireHandler = setInterval(function () {
- var x = ($('#Game').width() - 200) * Math.random() + 100;
- var y = ($('#Game').height() - 600) * Math.random() + 300;
+ this.tomatoFireHandler = setTimeout(this.autoFireTomato.bind(this), 500);
- Game.fireTomato2(x, y);
+ //this.bgAudio.play();
+ },
- }, 500);
+ autoFireTomato: function () {
+ var x = ($('#Game').width() - 200) * Math.random() + 100;
+ var y = ($('#Game').height() - 600) * Math.random() + 300;
- //this.bgAudio.play();
+ var tomatosCount = $('#Game .balance span').html();
+
+ this.fireTomato2(x, y);
+
+ this.tomatoFireHandler = setTimeout(this.autoFireTomato.bind(this), 5 * tomatosCount + Math.random() * 500);
},
finishGame: function (isWinner) {
@@ -344,10 +349,12 @@ var Game = {
var newImg = new Image();
newImg.src = RootUrl + 'Images/user_avatar_hp_' + _this.userHP + '.png';
- _this.userImg.setImage(newImg);
+ newImg.onload = function () {
+ _this.userImg.setImage(newImg);
+ };
} else {
- clearInterval(_this.tomatoFireHandler);
+ clearTimeout(_this.tomatoFireHandler);
_this.finishGame(false);
}
View
51 Jok.Pitching/Jok.Pitching/Views/Home/Play.cshtml
@@ -11,30 +11,31 @@
var RootUrl = '@System.Configuration.ConfigurationManager.AppSettings["SiteUrl"]';
</script>
@Styles.Render("~/Content/css")
-
-<div id="Game">
- @*<img class="user_avatar" data-hp="5" src="@Url.ContentAbsUrl("~/Images/user_avatar_hp_5.png")" />*@
- <div class="balance">
- <span>100</span>
- </div>
- @*<img class="tribuna" src="@Url.ContentAbsUrl("~/Images/gift-package.png")" />*@
- @*<div class="result"></div>*@
- @*<div class="volume">
- <span class="glyphicon glyphicon-volume-off" style="display: none;"></span>
- <span class="glyphicon glyphicon-volume-up"></span>
- </div>*@
- <div id="Container">
- </div>
-</div>
-<div id="Menu">
- <div class="start">
- <img src="@Url.ContentAbsUrl("~/Images/gamejam.png")" /><br /><br />
- <button id="StartGame" class="btn btn-default btn-lg">@R.A001</button>
+<div id="Root">
+ <div id="Game">
+ @*<img class="user_avatar" data-hp="5" src="@Url.ContentAbsUrl("~/Images/user_avatar_hp_5.png")" />*@
+ <div class="balance">
+ <span>100</span>
+ </div>
+ @*<img class="tribuna" src="@Url.ContentAbsUrl("~/Images/gift-package.png")" />*@
+ @*<div class="result"></div>*@
+ @*<div class="volume">
+ <span class="glyphicon glyphicon-volume-off" style="display: none;"></span>
+ <span class="glyphicon glyphicon-volume-up"></span>
+ </div>*@
+ <div id="Container">
+ </div>
</div>
- <div class="finish">
- <div class="results"></div>
- <button id="PlayAgain" class="btn btn-default btn-lg">@R.A004</button>
+ <div id="Menu">
+ <div class="start">
+ <img src="@Url.ContentAbsUrl("~/Images/gamejam.png")" /><br /><br />
+ <button id="StartGame" class="btn btn-default btn-lg">@R.A001</button>
+ </div>
+ <div class="finish">
+ <div class="results"></div>
+ <button id="PlayAgain" class="btn btn-default btn-lg">@R.A004</button>
+ </div>
</div>
-</div>
-@*<script src="http://debug.jok.io/target/target-script-min.js#anonymous"></script>*@
-@Scripts.Render("~/bundles/js")
+ <script src="http://debug.jok.io/target/target-script-min.js#anonymous"></script>
+ @Scripts.Render("~/bundles/js")
+</div>
View
2  Jok.Pitching/Jok.Pitching/Views/Shared/_Layout.cshtml
@@ -2,9 +2,9 @@
<html>
<head>
<meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=no">
<title>Game Jam - Fun</title>
<meta property="og:image" content="http://gamejamfun.jok.io/Images/user_avatar_hp_4.png">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
</head>
<body>
@RenderBody()
Please sign in to comment.
Something went wrong with that request. Please try again.