-
Notifications
You must be signed in to change notification settings - Fork 5
/
BabylonJS_maze_07.html
505 lines (477 loc) · 19.6 KB
/
BabylonJS_maze_07.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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title> Babylon.js - Maze_01 Finish - 2019/12/16 by T. Fujita</title>
<link rel = "stylesheet" type="text/css" href = "./css/babylon_menu_12.css" />
<script src="https://code.jquery.com/pep/0.4.0/pep.min.js"></script>
<script src="https://cdn.babylonjs.com/babylon.js"></script>
<script src="https://cdn.babylonjs.com/gui/babylon.gui.js"></script>
<script src="https://cdn.babylonjs.com/loaders/babylonjs.loaders.js"></script>
<script src="./maze_01.js"></script>
</head>
<body onLoad = "init()">
<nav id="menu-wrap">
<ul id="menu">
<li><a href="#">Menu</a>
<ul>
<li><a><span class = "fsize_12">Click the left side. Then, you can control the character.</span></a></li>
<li><a><span class = "fsize_12">Click the right side. Then, you can control the camera.</span></a></li>
</ul>
</li>
<li><a href="#">Maze's Size</a>
<ul id="scroll">
<li><a><input type = "radio" name = "maze_Layer" value = "0" checked onclick = "javascript: Sel_maze_Layer();">33 x 25</a></li>
<li><a><input type = "radio" name = "maze_Layer" value = "1" onclick = "javascript: Sel_maze_Layer();">15 x 11</a></li>
<li><a><input type = "radio" name = "maze_Layer" value = "2" onclick = "javascript: Sel_maze_Layer();">25 x 21</a></li>
<li><a><input type = "radio" name = "maze_Layer" value = "3" onclick = "javascript: Sel_maze_Layer();">35 x 31</a></li>
<li><a><input type = "radio" name = "maze_Layer" value = "4" onclick = "javascript: Sel_maze_Layer();">45 x 41</a></li>
<li><a><input type = "radio" name = "maze_Layer" value = "5" onclick = "javascript: Sel_maze_Layer();">55 x 51</a></li>
<li><a><input type = "radio" name = "maze_Layer" value = "6" onclick = "javascript: Sel_maze_Layer();">65 x 61</a></li>
<li><a><input type = "radio" name = "maze_Layer" value = "7" onclick = "javascript: Sel_maze_Layer();">75 x 71</a></li>
<li><a><input type = "radio" name = "maze_Layer" value = "8" onclick = "javascript: Sel_maze_Layer();">85 x 81</a></li>
<li><a><input type = "radio" name = "maze_Layer" value = "9" onclick = "javascript: Sel_maze_Layer();">95 x 91</a></li>
</ul>
</li>
<li><a href="#">Walk Speed</a>
<ul>
<li><a href="#" onclick = "Slow()">Slow</a></li>
<li><a href="#" onclick = "Medium()">Medium</a></li>
<li><a href="#" onclick = "Fast()">Fast</a></li>
</ul>
</li>
<li><a href="#">Game Start</a>
<ul>
<li><a href="#" onclick = "init()">Start Game</a></li>
<li><a href="#" onclick = "window.location.reload()">All Reset</a></li>
</ul>
</li>
</ul>
</nav>
<canvas id = "renderCanvas"></canvas>
<script type = "text/javascript">
"use strict";
var engine;
var scene;
var canvas = document.getElementById("renderCanvas");
var temp_Environment = "./textures/TropicalSunnyDay";
var camera;
var Maze_size_X = 33; // The row size of maze.
var Maze_size_Z = 25; // The col size of maze.
var BLOCK_SIZE = 8;
var walk_org = 0.6;
var walk_step = 0.5;
var walk_dir = 90 / 180 * Math.PI;
var Goal_x, Goal_y, Goal_z;
var Goal_flag = 0;
var x, y, z;
var temp_dir = "./scenes/GLTF/ruby/";
var gltf_data_01 = "ruby_03ani.glb";
var gltf_data_02 = "rv_lamp_post_3_01.glb";
var moveX = 0;
var moveY = 0;
var moveZ = 0;
var pos_row_00 = 0;
var pos_row_01 = 0;
var pos_row_02 = 0;
var pos_col_00 = 0;
var pos_col_01 = 0;
var pos_col_02 = 0;
var limit = BLOCK_SIZE - 5;
var Temp_Room = [];
function init() {
Goal_flag = 0;
Temp_Room[0] = "F";
for(var i = 0; i < Maze_size_Z + 4; i++) {
Temp_Room[0] = Temp_Room[0] + "F";
}
for(var i = 0; i < Maze_size_X + 4; i++) {
Temp_Room[i] = Temp_Room[0];
}
engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });
scene = createScene();
engine.runRenderLoop(function() {
scene.render();
});
}
var createScene = function() {
var scene = new BABYLON.Scene(engine);
var ROOM = Maze(Maze_size_Z, Maze_size_X);
for(var i = 0; i < Maze_size_X; i++) {
Temp_Room[i + 2] = "FF" + ROOM[i] + "FF";
}
// Camera
camera = new BABYLON.ArcRotateCamera("Camera", 0/180*Math.PI, 30/180*Math.PI, 10, new BABYLON.Vector3(0, 8, 0), scene);
camera.setPosition(new BABYLON.Vector3((BLOCK_SIZE * Maze_size_X / 2 * -1) - 40, 30, (BLOCK_SIZE * Maze_size_Z / 2 * -1) + 12));
// Ground
var groundMaterial = new BABYLON.StandardMaterial("ground", scene);
groundMaterial.diffuseTexture = new BABYLON.Texture("./textures/floor4.jpg", scene);
groundMaterial.diffuseTexture.uScale = Maze_size_X;
groundMaterial.diffuseTexture.vScale = Maze_size_Z;
groundMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
var ground = BABYLON.Mesh.CreateGround("ground", (Maze_size_X + 2) * BLOCK_SIZE, (Maze_size_Z + 2) * BLOCK_SIZE, 1, scene, false);
ground.material = groundMaterial;
ground.receiveShadows = true;
//Skybox
var skybox = BABYLON.Mesh.CreateBox("skyBox", 10000.0, scene);
var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene);
skyboxMaterial.backFaceCulling = false;
skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture(temp_Environment, scene);
skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
skybox.material = skyboxMaterial;
// Lights
var light0 = new BABYLON.DirectionalLight('light00', new BABYLON.Vector3(2000, -6000, 5000), scene);
light0.position = new BABYLON.Vector3(100, 100, -100);
light0.intensity = 1.0;
var light1 = new BABYLON.HemisphericLight("light01", new BABYLON.Vector3(0, 1000, 0), scene);
light1.position = new BABYLON.Vector3(1000, 1000, 1000);
light1.intensity = 0.5;
var light2 = new BABYLON.PointLight("light02", new BABYLON.Vector3(0, 1000, 0), scene);
light2.range = 100;
light2.parent = bulb;
var shadowGenerator = new BABYLON.ShadowGenerator(1024, light0);
// Create Materials
var cubeMaterial = new BABYLON.StandardMaterial("cube", scene);
var cubetexture = new BABYLON.Texture("./textures/block_texture.png", scene);
cubeMaterial.diffuseTexture = cubetexture;
var goalMaterial = new BABYLON.StandardMaterial("goal", scene);
var goaltexture = new BABYLON.Texture("./textures/Goal_02.png", scene);
goalMaterial.diffuseTexture = goaltexture;
var bulb = BABYLON.Mesh.CreateSphere('bulb', 10, 1.0, scene);
// Create Cube
var columns = 6;
var rows = 1;
var faceUV = new Array(6);
for (var i = 0; i < 6; i++) {
faceUV[i] = new BABYLON.Vector4(i / columns, 0, (i + 1) / columns, 1 / rows);
}
var options = {
width: BLOCK_SIZE,
height: BLOCK_SIZE,
depth: BLOCK_SIZE,
faceUV: faceUV
};
var options_G = {
width: BLOCK_SIZE,
height: 0.2,
depth: BLOCK_SIZE,
faceUV: faceUV
};
// Create a Maze
for (var row = 0; row < Maze_size_X; row++) {
for (var col = 0; col < Maze_size_Z; col++) {
if(ROOM[row].substr(col, 1) == "W") {
var cube = BABYLON.MeshBuilder.CreateBox('Cube', options, scene);
cube.material = cubeMaterial;
cube.position = new BABYLON.Vector3(BLOCK_SIZE / 2 + (row - (Maze_size_X / 2)) * BLOCK_SIZE, BLOCK_SIZE / 2, BLOCK_SIZE / 2 + (col - (Maze_size_Z / 2)) * BLOCK_SIZE);
shadowGenerator.addShadowCaster(cube);
shadowGenerator.getShadowMap().renderList.push(cube);
cube.receiveShadows = true;
}
if(ROOM[row].substr(col, 1) == "G") {
Goal_x = BLOCK_SIZE / 2 + (row - Maze_size_X / 2) * BLOCK_SIZE;
Goal_z = BLOCK_SIZE / 2 + (col - Maze_size_Z / 2) * BLOCK_SIZE;
var goalCube = BABYLON.MeshBuilder.CreateBox('goalCube', options_G, scene);
goalCube.material = goalMaterial;
goalCube.position = new BABYLON.Vector3(Goal_x, 0.1, Goal_z);
goalCube.receiveShadows = true;
BABYLON.SceneLoader.ImportMesh("", temp_dir, gltf_data_02, scene, function (newMeshes2) {
var lamp = newMeshes2[0];
lamp.position = new BABYLON.Vector3(Goal_x + 3, 0, Goal_z + 3);
lamp.scaling = new BABYLON.Vector3(1, 1.5, 1);
var materialSphere = new BABYLON.StandardMaterial("sphere0", scene);
materialSphere.emissiveColor = new BABYLON.Color3(1.0, 0.84, 0.0);
bulb.position = new BABYLON.Vector3(Goal_x + 3, 27, Goal_z + 3);
bulb.material = materialSphere;
shadowGenerator.addShadowCaster(lamp);
shadowGenerator.getShadowMap().renderList.push(lamp);
});
}
if(ROOM[row].substr(col, 1) == "P") {
x = BLOCK_SIZE / 2 + (row - (Maze_size_X / 2)) * BLOCK_SIZE;
y = 0;
z = BLOCK_SIZE / 2 + (col - (Maze_size_Z / 2)) * BLOCK_SIZE;
BABYLON.SceneLoader.ImportMesh("", temp_dir, gltf_data_01, scene, function (newMeshes1) {
var player = newMeshes1[0];
player.rotationQuaternion = undefined;
player.scaling = new BABYLON.Vector3(0.08, 0.08, 0.08);
player.position = new BABYLON.Vector3(x, y, z);
player.rotation.y = 180/180 * Math.PI + walk_dir;
camera.target = player;
shadowGenerator.addShadowCaster(player);
shadowGenerator.getShadowMap().renderList.push(player);
player.receiveShadows = true;
scene.registerBeforeRender(function() {
if((moveX == -1) && (player.position.x <= (BLOCK_SIZE * (Maze_size_X + 2) / -2) + 2)) {
moveX = 0;
}
if((moveX == 1) && (player.position.x >= (BLOCK_SIZE * (Maze_size_X + 2) / 2) - 2)) {
moveX = 0;
}
if((moveZ == -1) && (player.position.z <= (BLOCK_SIZE * (Maze_size_Z + 2) / -2) + 2)) {
moveZ = 0;
}
if((moveZ == 1) && (player.position.z >= (BLOCK_SIZE * (Maze_size_Z + 2) / 2) - 2)) {
moveZ = 0;
}
x = player.position.x;
z = player.position.z;
pos_row_00 = Math.round(((x - BLOCK_SIZE / 2) / BLOCK_SIZE) + (Maze_size_X / 2));
pos_row_01 = Math.round((((x + limit) - BLOCK_SIZE / 2) / BLOCK_SIZE) + (Maze_size_X / 2));
pos_row_02 = Math.round((((x - limit) - BLOCK_SIZE / 2) / BLOCK_SIZE) + (Maze_size_X / 2));
pos_col_00 = Math.round(((z - BLOCK_SIZE / 2) / BLOCK_SIZE) + (Maze_size_Z / 2));
pos_col_01 = Math.round((((z + limit) - BLOCK_SIZE / 2) / BLOCK_SIZE) + (Maze_size_Z / 2));
pos_col_02 = Math.round((((z - limit) - BLOCK_SIZE / 2) / BLOCK_SIZE) + (Maze_size_Z / 2));
if((moveX == 1) && (Temp_Room[pos_row_01 + 2].substr(pos_col_00 + 2, 1) == "W")) { moveX = 0; }
if((moveX == -1) && (Temp_Room[pos_row_02 + 2].substr(pos_col_00 + 2, 1) == "W")) { moveX = 0; }
if((moveZ == 1) && (Temp_Room[pos_row_00 + 2].substr(pos_col_01 + 2, 1) == "W")) { moveZ = 0; }
if((moveZ == -1) && (Temp_Room[pos_row_00 + 2].substr(pos_col_02 + 2, 1) == "W")) { moveZ = 0; }
player.position.x = x + walk_step * moveX;
player.position.y = 0;
player.position.z = z + walk_step * moveZ;
player.rotation.y = walk_dir;
});
});
}
}
}
// Create VirtualJoystick and set z index to be below playgrounds top bar
var leftJoystick = new BABYLON.VirtualJoystick(true);
var rightJoystick = new BABYLON.VirtualJoystick(false);
BABYLON.VirtualJoystick.Canvas.style.zIndex = "4";
// Render loop for VirtualJoystick
scene.onBeforeRenderObservable.add(()=>{
moveX=0;
moveZ=0;
if(leftJoystick.pressed){
if(leftJoystick.deltaPosition.x <= -0.5) {
walk_dir = 0 / 180 * Math.PI;
moveX = 0;
moveZ = 1;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.x, 2);
} else if(leftJoystick.deltaPosition.x >= 0.5) {
walk_dir = 180 / 180 * Math.PI;
moveX = 0;
moveZ = -1;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.x, 2);
} else {
moveZ = 0;
}
if(leftJoystick.deltaPosition.y <= -0.5) {
walk_dir = -90 / 180 * Math.PI;
moveX = -1;
moveZ = 0;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.y, 2);
} else if(leftJoystick.deltaPosition.y >= 0.5) {
walk_dir = 90 / 180 * Math.PI;
moveX = 1;
moveZ = 0;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.y, 2);
} else {
moveX = 0;
}
if((camera.alpha >= -135 / 180 * Math.PI) && (camera.alpha < -45 / 180 * Math.PI)) {
if(leftJoystick.deltaPosition.x <= -0.5) {
walk_dir = -90 / 180 * Math.PI;
moveX = -1;
moveZ = 0;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.x, 2);
} else if(leftJoystick.deltaPosition.x >= 0.5) {
walk_dir = 90 / 180 * Math.PI;
moveX = 1;
moveZ = 0;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.x, 2);
} else {
moveX = 0;
}
if(leftJoystick.deltaPosition.y <= -0.5) {
walk_dir = 180 / 180 * Math.PI;
moveX = 0;
moveZ = -1;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.y, 2);
} else if(leftJoystick.deltaPosition.y >= 0.5) {
walk_dir = 0 / 180 * Math.PI;
moveX = 0;
moveZ = 1;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.y, 2);
} else {
moveZ = 0;
}
}
if((camera.alpha >= -45 / 180 * Math.PI) && (camera.alpha < 45 / 180 * Math.PI)) {
if(leftJoystick.deltaPosition.x <= -0.5) {
walk_dir = 180 / 180 * Math.PI;
moveX = 0;
moveZ = -1;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.x, 2);
} else if(leftJoystick.deltaPosition.x >= 0.5) {
walk_dir = 0 / 180 * Math.PI;
moveX = 0;
moveZ = 1;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.x, 2);
} else {
moveZ = 0;
}
if(leftJoystick.deltaPosition.y <= -0.5) {
walk_dir = 90 / 180 * Math.PI;
moveX = 1;
moveZ = 0;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.y, 2);
} else if(leftJoystick.deltaPosition.y >= 0.5) {
walk_dir = -90 / 180 * Math.PI;
moveX = -1;
moveZ = 0;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.y, 2);
} else {
moveX = 0;
}
}
if((camera.alpha >= 45 / 180 * Math.PI) && (camera.alpha < 135 / 180 * Math.PI)) {
if(leftJoystick.deltaPosition.x <= -0.5) {
walk_dir = 90 / 180 * Math.PI;
moveX = 1;
moveZ = 0;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.x, 2);
} else if(leftJoystick.deltaPosition.x >= 0.5) {
walk_dir = -90 / 180 * Math.PI;
moveX = -1;
moveZ = 0;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.x, 2);
} else {
moveX = 0;
}
if(leftJoystick.deltaPosition.y <= -0.5) {
walk_dir = 0 / 180 * Math.PI;
moveX = 0;
moveZ = 1;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.y, 2);
} else if(leftJoystick.deltaPosition.y >= 0.5) {
walk_dir = 180 / 180 * Math.PI;
moveX = 0;
moveZ = -1;
walk_step = walk_org * Math.pow(leftJoystick.deltaPosition.y, 2);
} else {
moveZ = 0;
}
}
}
if(rightJoystick.pressed){
if(rightJoystick.deltaPosition.x <= -0.5) {
camera.alpha = camera.alpha + rightJoystick.deltaPosition.x/180*Math.PI;
if(camera.alpha < -1 * Math.PI) {
camera.alpha = Math.PI;
}
}
else if(rightJoystick.deltaPosition.x >= 0.5) {
camera.alpha = camera.alpha + rightJoystick.deltaPosition.x/180*Math.PI;
if(camera.alpha > Math.PI) {
camera.alpha = -1 * Math.PI;
}
}
else {
camera.alpha = camera.alpha;
}
if(rightJoystick.deltaPosition.y <= -0.5) {
camera.radius = camera.radius + 0.5;
}
else if(rightJoystick.deltaPosition.y >= 0.5) {
camera.radius = camera.radius - 0.5;
}
else {
camera.radius = camera.radius;
}
if((rightJoystick.deltaPosition.x <= -0.6) && (rightJoystick.deltaPosition.y <= -0.6)) {
camera.alpha = camera.alpha;
camera.beta = camera.beta + 0.2/180*Math.PI;
camera.radius = camera.radius;
}
else if((rightJoystick.deltaPosition.x <= -0.6) && (rightJoystick.deltaPosition.y >= 0.6)) {
camera.alpha = camera.alpha;
camera.beta = camera.beta - 0.2/180*Math.PI;
camera.radius = camera.radius;
}
else if((rightJoystick.deltaPosition.x >= 0.6) && (rightJoystick.deltaPosition.y <= -0.6)) {
camera.alpha = camera.alpha;
camera.beta = camera.beta + 0.2/180*Math.PI;
camera.radius = camera.radius;
}
else if((rightJoystick.deltaPosition.x >= 0.6) && (rightJoystick.deltaPosition.y >= 0.6)) {
camera.alpha = camera.alpha;
camera.beta = camera.beta - 0.2/180*Math.PI;
camera.radius = camera.radius;
}
}
});
// Create button to toggle VirtualJoystick overlay canvas
var btn = document.createElement("button");
btn.innerText = "Enable/Disable Joystick";
btn.style.zIndex = 10;
btn.style.position = "absolute";
btn.style.bottom = "50px";
btn.style.right = "0px";
document.body.appendChild(btn);
// Button toggle logic for VirtualJoystick
btn.onclick = ()=>{
if(BABYLON.VirtualJoystick.Canvas.style.zIndex == "-1"){
BABYLON.VirtualJoystick.Canvas.style.zIndex = "4";
}else{
BABYLON.VirtualJoystick.Canvas.style.zIndex = "-1";
}
}
// Dispose button on rerun for VirtualJoystick
scene.onDisposeObservable.add(()=>{
document.body.removeChild(btn);
});
// Moving Limit for Camera
var angle = 0.03;
var plane_Axis = new BABYLON.Vector3(0, 90, 0);
var beforeRenderFunction = function () {
camera.lowerBetaLimit = 0.1;
camera.upperBetaLimit = (Math.PI / 2) * 0.9;
camera.lowerRadiusLimit = 10;
camera.upperRadiusLimit = 1500;
camera.attachControl(canvas, true);
if((Math.round(x / 8) == Math.round(Goal_x / 8)) && (Math.round(z / 8) == Math.round(Goal_z / 8)) && (Goal_flag == 0)) {
var advancedTexture_01 = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI");
var text1 = new BABYLON.GUI.TextBlock();
text1.text = "GOAL !";
text1.color = "red";
text1.fontSize = 100;
advancedTexture_01.addControl(text1);
var music = new BABYLON.Sound('Goal', './sound/info-girl1-goal1.mp3', scene, function() {
music.play();
Goal_flag = 1;
});
}
};
scene.registerBeforeRender(beforeRenderFunction);
return scene;
};
function Sel_maze_Layer() {
var temp = document.getElementsByName("maze_Layer");
Maze_size_X = 33;
Maze_size_Z = 25;
if(temp[1].checked) { Maze_size_X = 15; Maze_size_Z = 11;}
if(temp[2].checked) { Maze_size_X = 25; Maze_size_Z = 21;}
if(temp[3].checked) { Maze_size_X = 35; Maze_size_Z = 31;}
if(temp[4].checked) { Maze_size_X = 45; Maze_size_Z = 41;}
if(temp[5].checked) { Maze_size_X = 55; Maze_size_Z = 51;}
if(temp[6].checked) { Maze_size_X = 65; Maze_size_Z = 61;}
if(temp[7].checked) { Maze_size_X = 75; Maze_size_Z = 71;}
if(temp[8].checked) { Maze_size_X = 85; Maze_size_Z = 81;}
if(temp[9].checked) { Maze_size_X = 95; Maze_size_Z = 91;}
}
function Slow() {
walk_org = 0.4;
}
function Medium() {
walk_org = 0.8;
}
function Fast() {
walk_org = 1.2;
}
</script>
</body>
</html>