Graphics Programs Reference
In-Depth Information
28
29
30
31
scene3D.attachMovie("Queen","Queen",3,{ x:40, y:-220, z:1450} );
scene3D.attachMovie("Guard","Guard",5,{ x:30, y:-280, z:1409 });
scene3D.attachMovie("K1","Knight1",7, { x:320, y:-325, z:1405 });
// right back 1
scene3D.attachMovie("K1","Knight2",6, { x:550, y:-335, z:1403 });
// right back 2
scene3D.attachMovie("K2","Knight3",10,{ x:850, y:-400, z:1351 });
// right mid
scene3D.attachMovie("K2","Knight4",11,{ x:380, y:-400, z:601 });
32
33
34
// right front
35
36
scene3D.attachMovie("K3","Knight5",9, { x:-250, y:-320, z:1408});
// left back 1
scene3D.attachMovie("K3","Knight6",8, { x:-500, y:-330, z:1404});
// left back 2
scene3D.attachMovie("K4","Knight7",12,{ x:-750, y:-400, z:1352});
// left mid
scene3D.attachMovie("K4","Knight8",13,{ x:-200, y:-400, z:742 });
37
38
39
// left front
40
Stage. This is the name that you enter in the Identifier field in the Linkage Properties
dialog box.
The displayObj() function is pretty standard. Since we are using the arrow keys to
navigate around the scene, we put some restrictions on the viewer's x-movement and
z-movement as shown below. These limits are easy to obtain using a trace(viewer.x)
and a trace(viewer.z) command.
60
61
62
63
64
65
66
67
// restrict the viewer x-movement
if (viewer.x < -385 ) { viewer.x = -385; }
if (viewer.x > 385 ) { viewer.x = 385; }
// restrict the viewer z-movement
if (viewer.z < -120 ) { viewer.z = -120; }
if (viewer.z > 1060 ) { viewer.z = 1060; }
Search WWH ::




Custom Search