Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

improvesments

  • Loading branch information...
commit ceccfceb35d5009cf51c53f428a56a6a3f95b6e6 1 parent 99899d6
@ericz authored
View
27 admin/public/css/style.css
@@ -33,6 +33,16 @@ body, html {
background-color: #fff;
}
+#left {
+ float: left;
+ margin: 100px;
+}
+
+#right {
+ float: left;
+ margin: 100px;
+}
+
.green {
background-color: #bdecb6;
}
@@ -67,8 +77,25 @@ body, html {
transition: all 150ms ease-in-out;
cursor: pointer;
border-radius: 3px;
+ -webkit-touch-callout: none;
+-webkit-user-select: none;
+-khtml-user-select: none;
+-moz-user-select: none;
+-ms-user-select: none;
+-o-user-select: none;
+user-select: none;
}
.lang:hover {
box-shadow: inset 0 -3px 0 0 rgba(0,0,0,0.3);
+}
+
+.big {
+ font-size: 40px;
+ height: 60px;
+ line-height: 60px;
+}
+
+.big:active {
+ background-color: #666;
}
View
14 admin/public/js/control.js
@@ -23,5 +23,19 @@ $(function(){
bridge.ready(function(){
bridge.getService('physics', function(obj){physics = obj});
});
+
+ $('#lu').mousedown(function(){
+ physics.movePaddle('1', -50);
+ });
+ $('#ld').mousedown(function(){
+ physics.movePaddle('1', 50);
+ });
+ $('#ru').mousedown(function(){
+ physics.movePaddle('2', -50);
+ });
+ $('#rd').mousedown(function(){
+ physics.movePaddle('2', 50);
+ });
+
});
View
9 admin/views/control.ejs
@@ -19,6 +19,13 @@
</head>
<body>
- <h1>CONTROL</h1>
+ <div id="left">
+ <div id="lu" class="lang green big">UP</div><br><br>
+ <div id="ld" class="lang green big">DOWN</div>
+ </div>
+ <div id="right">
+ <div id="ru" class="lang red big">UP</div><br><br>
+ <div id="rd" class="lang red big">DOWN</div>
+ </div>
</body>
</html>
View
10 physics.js
@@ -211,14 +211,14 @@ physics = {
vel = {x:Math.abs(vel.x),y:Math.abs(vel.y)};
}
if ((nextXBall.x>=paddle1.x1&&nextXBall.x<=paddle1.x2&&nextXBall.y<=paddle1.y2&&nextXBall.y>=paddle1.y2)||(nextXBall.x<=paddle1.x2&&nextXBall.x>=paddle1.x1&&nextXBall.y<=paddle1.y2&&nextXBall.y>=paddle1.y1)){
- vel.x = -vel.x;
- vel.x *= 1.1;
- vel.y *= 1.1;
+ vel.x = -vel.x;
+ vel.x *= 1.1;
+ vel.y *= 1.1;
}
if ((nextXBall.x>=paddle2.x1&&nextXBall.x<=paddle2.x2&&nextXBall.y<=paddle2.y2&&nextXBall.y>=paddle2.y2)||(nextXBall.x<=paddle2.x2&&nextXBall.x>=paddle2.x1&&nextXBall.y<=paddle2.y2&&nextXBall.y>=paddle2.y1)){
- vel.x = -vel.x;
+ vel.x = -vel.x;
vel.x *= 1.1;
- vel.y *= 1.1;
+ vel.y *= 1.1;
}
if (nextXBox == -1){
vel.x = -vel.x;
Please sign in to comment.
Something went wrong with that request. Please try again.