Game Development Reference
In-Depth Information
eb$_khheoekjD]oK__qnna`%
w
o_kna''7
iaoo]ca@eolh]u*patp9Opnejc$o_kna%7
_khheoekjD]oK__qnna`9pnqa7
y
y
ahoa
w
ajaiu*ckpk=j`Opkl$-%7
_khheoekjD]oK__qnna`9b]hoa7
y
++?da_gbknaj`kbc]ia
eb$da]hpd*iapan*se`pd8-%
w
iaoo]ca@eolh]u*patp9C]iaKran7
y
y
3. Save the I]ej[Lh]ucnkqj`*]o file and test the project. The
score now only updates by 1 each time the objects collide.
That's much more manageable! Figure 7-16 shows an example
of what you should see after the second collision.
Figure 7-16. The score now
updates only once every
collision.
Let's take a quick stroll through the logic of what's going on here. First, the new _khheoekjD]oK__qnna`
variable was initialized to b]hoa in the ejep function definition:
_khheoekjD]oK__qnna`9b]hoa7
This might be stating the obvious, but it's crucially important to keep in mind for the next bit of code
to make any sense. This is the new code inside the eb/ahoa statement in the kjAjpanBn]ia event
handler:
eb$lh]uan*depPaopK^fa_p$ajaiu%%
w
ajaiu*ckpk=j`Opkl$.%7
da]hpd*iapan*se`pd))7
eb$_khheoekjD]oK__qnna`%
w
o_kna''7
iaoo]ca@eolh]u*patp9Opnejc$o_kna%7
_khheoekjD]oK__qnna`9pnqa7
y
y
ahoa
w
ajaiu*ckpk=j`Opkl$-%7
_khheoekjD]oK__qnna`9b]hoa7
y
 
Search Nedrilad ::




Custom Search