Game Development Reference
In-Depth Information
^]_gcnkqj`*u)9ru7
y
ahoaeb$lh]uan*u'lh]uanD]hbDaecdp:^kppkiEjjan>kqj`]nu%
w
lh]uan*u9^kppkiEjjan>kqj`]nu)lh]uanD]hbDaecdp7
^]_gcnkqj`*u)9ru7
y
++Opkl^]_gcnkqj`]pop]caa`cao
eb$^]_gcnkqj`*t'^]_gcnkqj`D]hbSe`pd8op]ca*op]caSe`pd%
w
^]_gcnkqj`*t9op]ca*op]caSe`pd)^]_gcnkqj`D]hbSe`pd7
y
ahoaeb$^]_gcnkqj`*t)^]_gcnkqj`D]hbSe`pd:,%
w
^]_gcnkqj`*t9,'^]_gcnkqj`D]hbSe`pd7
y
eb$^]_gcnkqj`*u)^]_gcnkqj`D]hbDaecdp:,%
w
^]_gcnkqj`*u9,'^]_gcnkqj`D]hbDaecdp7
y
ahoaeb$^]_gcnkqj`*u'^]_gcnkqj`D]hbDaecdp8op]ca*op]caDaecdp%
w
^]_gcnkqj`*u9op]ca*op]caDaecdp)^]_gcnkqj`D]hbDaecdp7
y
y
y
y
2. Save the I]ej[?d]n]_pan*]o file. You can now move the lh]uan object freely within the inner
boundaries of the stage. When it reaches the edge of the inner boundary, the ^]_gcnkqj`
object starts scrolling. Figure 6-16 illustrates this.
The first thing the code did was to define the inner boundary with these four new variables:
necdpEjjan>kqj`]nu9$op]ca*op]caSe`pd+.% ±
'$op]ca*op]caSe`pd+0%7
habpEjjan>kqj`]nu9$op]ca*op]caSe`pd+.% ±
)$op]ca*op]caSe`pd+0%7
pklEjjan>kqj`]nu9$op]ca*op]caDaecdp+.% ±
)$op]ca*op]caDaecdp+0%7
^kppkiEjjan>kqj`]nu9$op]ca*op]caDaecdp+.% ±
'$op]ca*op]caDaecdp+0%7
Can you figure out how the boundaries were calculated? (Try it, it's not that hard!) What you end up
with is an inner area that's half the size of the stage.
 
Search Nedrilad ::




Custom Search