Game Development Reference
In-Depth Information
Even better scrolling
You still have one more problem to solve. The lh]uan object still can't move all the way to the edges
of the stage when the scrolling ^]_gcnkqj` has reached its limit. To do this, you need to temporar-
ily extend the boundaries and then move them back if the lh]uan returns to the center of the stage
again. A few lines of very simple code in the right place are all you need to achieve this.
1. Add the following lines in bold to the kjAjpanBn]ia event handler:
bqj_pekjkjAjpanBn]ia$arajp6Arajp%6rke`
w
++Ejepe]hevahk_]hr]ne]^hao
r]nlh]uanD]hbSe`pd6qejp9lh]uan*se`pd+.7
r]nlh]uanD]hbDaecdp6qejp9lh]uan*daecdp+.7
r]n^]_gcnkqj`D]hbSe`pd6qejp9^]_gcnkqj`*se`pd+.7
r]n^]_gcnkqj`D]hbDaecdp6qejp9^]_gcnkqj`*daecdp+.7
++Ikrapdalh]uan
lh]uan*t'9rt7
lh]uan*u'9ru7
++Opkllh]uan]pejjan^kqj`]nua`cao
eb$lh]uan*t)lh]uanD]hbSe`pd8habpEjjan>kqj`]nu%
w
lh]uan*t9habpEjjan>kqj`]nu'lh]uanD]hbSe`pd7
necdpEjjan>kqj`]nu9$op]ca*op]caSe`pd+.% ±
'$op]ca*op]caSe`pd+0%7
^]_gcnkqj`*t)9rt7
y
ahoaeb$lh]uan*t'lh]uanD]hbSe`pd:necdpEjjan>kqj`]nu%
w
lh]uan*t9necdpEjjan>kqj`]nu)lh]uanD]hbSe`pd7
habpEjjan>kqj`]nu9$op]ca*op]caSe`pd+.% ±
)$op]ca*op]caSe`pd+0%7
^]_gcnkqj`*t)9rt7
y
eb$lh]uan*u)lh]uanD]hbDaecdp8pklEjjan>kqj`]nu%
w
lh]uan*u9pklEjjan>kqj`]nu'lh]uanD]hbDaecdp7
^kppkiEjjan>kqj`]nu9$op]ca*op]caDaecdp+.% ±
'$op]ca*op]caDaecdp+0%7
^]_gcnkqj`*u)9ru7
y
ahoaeb$lh]uan*u'lh]uanD]hbDaecdp:^kppkiEjjan>kqj`]nu%
w
lh]uan*u9^kppkiEjjan>kqj`]nu)lh]uanD]hbDaecdp7
pklEjjan>kqj`]nu9$op]ca*op]caDaecdp+.% ±
)$op]ca*op]caDaecdp+0%7
^]_gcnkqj`*u)9ru7
y
 
Search Nedrilad ::




Custom Search