Graphics Programs Reference
In-Depth Information
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
//create a viewer object with position x,y,z
viewer = {x:100, y:100, z:70}
// you play around with these values to see different views
// look at -50 vs 50 for y
// set the viewer parameters
var d:Number = 650; // distance from viewer to picture plane
var viewerSpeed:Number = 10; // viewspeed used with arrow keys
var tooClose:Number = 300; // the too close distance
// create the picture plane: a movie clip named scene3D
// and position it in the center of the Stage
this.createEmptyMovieClip("scene3D", 0)
scene3D._x = Stage.width/2;
scene3D._y = Stage.height/2;
// add objects to the scene in 3D space
scene3D.createEmptyMovieClip("villageScene", 1);
scene3D.villageScene.loadMovie("theVillage/village.jpg");
scene3D.createEmptyMovieClip("street", 2);
scene3D.street.loadMovie("theVillage/street.jpg");
scene3D.createEmptyMovieClip("wall", 4);
scene3D.wall.loadMovie("theVillage/archway.png");
As a result of the grid overlay discussed earlier, a placeObj() function was defined to
locate the village and street in space. At this point, it also made sense to add the loca-
tion of the archway to the function. The arch needed to be located fairly far back in
space near the street. Its coordinates were determined with a few tests (Figure 7.35).
48
49
50
51
52
53
54
55
scene3D.street.x = -1440;
scene3D.street.y = -230;
scene3D.street.z = 1500;
scene3D.wall.x = -150;
scene3D.wall.y = 310;
scene3D.wall.z = 1440;
}
 
Search WWH ::




Custom Search