Game Development Reference
In-Depth Information
lq^he_bqj_pekjI]ej[IkqoaBkhhks$%
w
++Ejepe]hevar]ne]^hao
[p]ncapT9ikqoaT7
[p]ncapU9ikqoaU7
[rt9,7
[ru9,7
++=``arajpheopajano
]``ArajpHeopajan$Arajp*AJPAN[BN=IA(kjAjpanBn]ia%7
y
lner]pabqj_pekjkjAjpanBn]ia$arajp6Arajp%6rke`
w
[p]ncapT9ikqoaT7
[p]ncapU9ikqoaU7
++?]h_qh]papda`eop]j_abnkipdalh]uanpkpdaikqoa
r]n`t6Jqi^an9[p]ncapT)lh]uan*t7
r]n`u6Jqi^an9[p]ncapU)lh]uan*u7
r]n`eop]j_a9I]pd*omnp$`t&`t'`u&`u%7
++=llhua]oejcebpdalh]uaneoiknapd]j-letah]s]ubnki
++pdaikqoa
eb$`eop]j_a:9-%
w
[rt9$[p]ncapT)lh]uan*t%&A=OEJC7
[ru9$[p]ncapU)lh]uan*u%&A=OEJC7
y
++Ikralh]uan
lh]uan*t'9[rt7
lh]uan*u'9[ru7
y
y
y
A slight modification is that the easing is applied to the [rt and [ru variables. This gives you a bit
more flexibility because it means that you can easily add physical forces or collision detection to the
code if you need to. I hope you'll find this a useful starting point for your own customized character
control scheme or drag-and-drop engine.
One pitfall is that the I]pd*omnp is one of the most CPU-intensive math functions you can call. If you
can avoid using it, you'll save a great deal of processing power. In the case study ahead, you'll look at
a way to optimize this code so that it achieves the same thing without using I]pd*omnp.
 
Search Nedrilad ::




Custom Search