Uh oh!
There was an error while loading. Please reload this page.
forked from flipcomputing/flock
- Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathexample.html
More file actions
Latest commit
75 lines (69 loc) · 2.26 KB
/
Copy pathexample.html
File metadata and controls
75 lines (69 loc) · 2.26 KB
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
<!doctype html>
<htmllang="en">
<head>
<metacharset="UTF-8" />
<metaname="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>
<canvasid="renderCanvas" touch-action="none" style="width: 640px; height: 360px;" tabindex="0"></canvas>
</div>
<scriptid="flock" type="application/flock">
// Made with Flock XR
letplayer='player';letcamera='camera';letbox1='box1';
(async()=>{
setSky("#ffffff");
createGround("#ffffff","ground");
printText('🌈 Hello',30,"#000080");
buttonControls("ARROWS",true,"#cc33cc");
camera=getCamera();
for(letcount=0;count<100;count++){
box1=createBox("box1__)C}CoPM~GwY.o.DvG%Ec",{color: randomColour(),width: (randomInteger(1,5)),height: (randomInteger(1,5)),depth: (randomInteger(1,5)),position: [(randomInteger(-20,20)),(randomInteger(0,10)),(randomInteger(-20,20))]});
awaitsetAlpha(box1,0.75);
awaitwait(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"
}
});
awaitsetPhysics(player,"DYNAMIC");
awaitattachCamera(player,{radius: 7,front: false});
})();
forever(asyncfunction(){
if(keyPressed("w")){
moveForward(player,3);
awaitswitchAnimation(player,{animationName: "Walk"});
}elseif(keyPressed("s")){
moveForward(player,(-3));
awaitswitchAnimation(player,{animationName: "Walk"});
}elseif(keyPressed("a")){
awaitrotate(camera,{x: 0,y: 1,z: 0});
}elseif(keyPressed("d")){
awaitrotate(camera,{x: 0,y: (-1),z: 0});
}else{
awaitswitchAnimation(player,{animationName: "Idle"});
}
});
</script>
<scripttype="module">
import"https://flipcomputing.github.io/flockupdate/flock.js";
</script>
</body>
</html>