-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
236 lines (201 loc) · 5.65 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<!doctype html>
<html>
<head>
<title>SPACE PONG SUPER</title>
<script src='Scripts/jquery-1.10.js'></script>
<script src='Scripts/jqeasing.js'></script>
<script src='Scripts/bpopup.js'></script>
<script src='Scripts/blockUI.js'></script>
<style>
body {
background-color: black;
overflow: hidden ;
}
#gameCanvas {
background-color: black;
position : absolute;
top : 0;
margin: auto;
align: center;
}
div.growlUI { background: url('images/check48.png') no-repeat 10px 10px }
div.growlUI { font : bold 3opx tahoma}
#scoreboard {
text-align: center;
color: white;
}
#myScore{
display:inline;
color : #009;
}
#cpuScore{
display:inline;
color : #900;
}
#scbg{
background : #fff;
opacity : .7 ;
font : bold 30px tahoma;
border-radius : 20px ;
position: absolute;
top:0;
left:0;
padding:20px;
margin:20px;
height : 150px ;
width :150px;
}
#board{
position : absolute ;
top:100px;
right :20px;
}
#title {
background-color: white;
color: black;
position :absolute ;
padding : 20px ;
margin : 20px ;
right:0 ;
top:0;
}
.message{
background : url('images/pattern.jpg');
padding : 30px ;
border-radius : 30px ;
font : bold 20px tahoma ;
}
#rules{
background : url('images/pattern.jpg');
padding : 30px ;
border-radius : 30px ;
font : bold 20px tahoma ;
position : absolute ;
left : 500px ;
}
</style>
</head>
<body onload='setup();'>
<script>
</script>
<div id='gameCanvas'></div>
<script src='./Scripts/three.min.js'></script>
<script src='./Scripts/keyboard.js'></script>
<script src='./Scripts/game.js'></script>
<div id="domMessage1" style="display:none;" class="message">
<h1>Player Wins ! Wanna play again ?</</h1> <br>
<a class="b-close"><input type="button" id="yes" value="Yes" onclick="fun()"/> </a>
<input type="button" id="no" value="No" />
</div>
<div id="domMessage2" style="display:none;" class="message">
<h1>CPU wins ! Wanna play again ?</h1> <br>
<a class="b-close"><input type="button" id="yes" value="Yes" onclick="fun()"/> </a>
<input type="button" id="no" value="No" />
</div>
<div id='scoreboard'>
<div id ="scbg">  <h1 id='cpuScore'>0</h1>-<br><h1 id = "myScore">0</h1></div>
<h1 id='title'>CSI - Spython</h1>
<span id = "board">
<h2 id="winnerBoard">First to 7 wins!</h2>
<h3>A - move left
<br>D - move right</h3>
</span>
</div>
<script>
function fun(){
paddleSpeed = 5 ;
ballSpeed = 2+Math.floor(Math.random()*2);
score1=score2=0;
document.getElementById("myScore").innerHTML = score1 ;
document.getElementById("cpuScore").innerHTML = score2 ;
resetBall(1);
Sounds.bg.repeat();
}
</script>
<div class="growlUI" style="display: none;">
<h1>+1</h1>
<h2 ><sp id ="pu">Well Done !</sp></h2>
</div>
<div class="growlUI1" style="display: none;">
<h1>Concentrate Dude!</h1>
</div>
<div class="growlUI1st" style="display: none;" id="kickoff">
<h1>Press Arrow Keys to Start </h1>
</div>
<div id="startMsg" style="display:none;" class="message">
<center>
<el style="font : bold 70px Tahoma ;color : red"> Ready ? </el><br>
<a class="b-close"><input type="button" id="yes" value="Play Now" onclick="set()"/> </a>
</center>
</div>
<script>
function set(){
createScene();
draw();
Sounds.bg.repeat();
ballSpeed =0 ;
$("body").on("keydown", kick);
$.blockUI({
message: $('div.growlUI1st'),
fadeIn: 700,
fadeOut: 700,
timeout: 4000,
showOverlay: false,
centerY: false,
css: {
width: '350px',
top: '300px',
left: '500px',
right: '',
border: 'none',
padding: '5px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .6,
color: '#fff'
}
});
start_interval();
}
function kick(){
document.getElementById("kickoff").style.display = 'none';
ballSpeed = 2+Math.floor(Math.random()*2);
$("body").off("keydown", null);
}
</script>
<script>
var last_request;
function aj(){
console.log("start of aj");
if(last_request){
console.log('last request not null');
last_request.abort();
}
last_request = $.ajax({
url: 'http://192.168.43.1:4040', //the script to call to get data
data: 'hi',
type: 'GET', //you can insert url argumnets here to pass to api.php for example "id=5&parent=6"
dataType: 'json', //data format
success: function(data) //on recieve of reply
{
console.log("response = "+ data.orientation) ; //get name
dir = data.orientation
},
error:function(){
console.log("error");
last_request = null ;
}
}).done(function(response){
console.log("killing last request");
// set the last request to null so that you dont abort a completed request
//(this might not be necessary)
last_request = null;
});
}
function start_interval(){
window.setInterval(aj,150) ;
}
</script>
</body>
</html>