Game Development Reference
In-Depth Information
The directive that is triggered by the kjQl>qppkj?he_g event handler is almost identical. Only the
u value is different.
dehhL]ca*_]p*u9-.,7
The number -., (which will be different in your program) is the original position of the cat—that you
noted from the Position and Size panes in the Properties panel. All you did is move the cat back to that
original position when the up button is clicked.
Understanding x and y positions of objects
In Flash and AS3.0, the leftmost side of the stage has an x position number of zero. As you move to
the right, the numbers increase. The rightmost side of the stage in the storybook has an x position
number of 550.
The very top of the stage has a y position number of zero. As an object moves down the stage, its y posi-
tion number increases. The very bottom of the stage in the storybook has a y position number of 400.
The fact that the y position number increases as you move down the stage is an odd quirk in Flash and
AS3.0's coordinate system that might take some getting used to. Figure 4-5 illustrates how to find the
x and y positions of objects on the stage.
x
100 200 300 400 500
0
100
200
y
300
400
Figure 4-5. The cat in this illustration has an x position of 400 and a y posi-
tion of 200.
As you can see, to move an object down the stage, you need to increase its u value.
 
Search Nedrilad ::




Custom Search