-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample.html
78 lines (69 loc) · 2.12 KB
/
example.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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Flock standalone example</title>
<style>
body {
font-family: "Asap", Helvetica, Arial, Lucida, sans-serif !important;
}
</style>
</head>
<body>
<canvas id="renderCanvas" touch-action="none" style="width: 640px; height: 360px;" tabindex="0"></canvas>
</div>
<script id="flock" type="application/flock">
// Made with Flock XR
let player = 'player'; let camera = 'camera'; let box1 = 'box1';
(async () => {
setSky("#ffffff");
createGround("#ffffff", "ground");
printText('🌈 Hello', 30, "#000080");
buttonControls("ARROWS", true, "#cc33cc");
camera = getCamera();
for (let count = 0; count < 100; count++) {
box1 = createBox("box1__)C}CoPM~GwY.o.DvG%Ec__)C}CoPM~GwY.o.DvG%Ec", randomColour(), (randomInteger(1, 5)), (randomInteger(1, 5)), (randomInteger(1, 5)), [(randomInteger(-20, 20)), (randomInteger(0, 10)), (randomInteger(-20, 20))]);
await setAlpha(box1, 0.75);
await wait(0);
}
})();
(async () => {
player = createCharacter({
modelName: 'Character2.glb',
modelId: 'player__Tu,7ioVs!0w8z^PEcbxX',
scale: 1,
position: { x: 0, y: 0, z: 0 },
colors: {
hair: "#ffcc00",
skin: "#f0d5b1",
eyes: "#33cc00",
sleeves: "#339999",
shorts: "#00008b",
tshirt: "#00cccc"
}
});
await setPhysics(player, "DYNAMIC");
await attachCamera(player, 7);
})();
forever(async () => {
if (keyPressed("w")) {
moveForward(player, 3);
await switchAnimation(player, "Walk");
} else if (keyPressed("s")) {
moveForward(player, (-3));
await switchAnimation(player, "Walk");
} else if (keyPressed("a")) {
await rotate(camera, 0, 1, 0);
} else if (keyPressed("d")) {
await rotate(camera, 0, (-1), 0);
} else {
await switchAnimation(player, "Idle");
}
});
</script>
<script type="module">
import "https://flipcomputing.github.io/flock/flock.js";
</script>
</body>
</html>