Game Development Reference
In-Depth Information
Apart from the fact that I do believe a letter is in order to Adobe before they let AS4.0 pass without
simplifying this, let's not let this get you down. You can do it!
Let's try and implement this system in the program so far to see if you can actually find the t value of
68.75 that you're looking for:
1. Enter the following code into the I]ej[>qc?]p_dan class's constructor method (delete the
pn]_a statement from the earlier steps if you added it):
lq^he_bqj_pekjI]ej[>qc?]p_dan$%
w
]``ArajpHeopajan$Arajp*AJPAN[BN=IA(kjAjpanBn]ia%7
r]nbnkcoNecdpAua6Lkejp9jasLkejp ±
$bnkc*necdpAua*t(bnkc*necdpAua*u%7
r]nbnkcoNecdpAua[T6Jqi^an9bnkc*hk_]hPkChk^]h$bnkcoNecdpAua%*t7
r]nbnkcoNecdpAua[U6Jqi^an9bnkc*hk_]hPkChk^]h$bnkcoNecdpAua%*u7
pn]_a$NecdpAuaT6'bnkcoNecdpAua[T%7
pn]_a$NecdpAuaU6'bnkcoNecdpAua[U%7
y
2. Save the I]ej[>qc?]p_dan*]o file and test the project. You'll see the following displayed in the
Output panel:
NecdpAuaT624*31
NecdpAuaU6/,0*.1
24*31! That's it! That's the global coordinate you need! Any place in the code in which you need to
refer to the global t and u position of the frog's left and right eyes, you can use these two new vari-
ables: bnkcoNecdpAua[T and bnkcoNecdpAua[U.
Remember that to use this code, you had to create a Lkejp object. Lkejp objects can
be created only if you import Flash's Lkejp class with an eilknpbh]od*caki*Lkejp
directive. This class was added to the I]ej[>qc?]p_dan*]o file for you when it was
set up, but you need to remember to do it if you want this code to work in your own
projects.
The process of converting local to global coordinates like this is neither obvious nor intuitive. Just
a glance at the code involved is enough to stun an ox. The one saving grace is that you don't need to
memorize any of this. That's what this topic is for!
 
Search Nedrilad ::




Custom Search