Game Development Reference
In-Depth Information
When the game runs, the number of bullets on the stage is displayed in the bottom-right corner of
the stage. The number comes from the [^qhhap array's hajcpd property. This is the line of code in the
document class's kjAjpanBn]ia event that produces it:
^qhhap@eolh]u*patp9>qhhapokjpdaop]ca6' ±
Opnejc$[^qhhapo*hajcpd%7
Now that you have a list of all the bullets on the stage, you can check whether they're colliding with
any other objects.
Checking for bullet collisions with objects
The document class checks for collisions between bullets, player, and robot in the kjAjpanBn]ia
event. Here's the entire code (I'll explain how each part works ahead):
bkn$r]ne6ejp9,7e8[^qhhapo*hajcpd7e''%
w
osep_d$[^qhhapoWeY*^qhhapPula%
w
_]oa_en_ha6
++?da_gbkn]_khheoekjsepdpdalh]uan
eb$lh]uan*depPaopLkejp$[^qhhapoWeY*t([^qhhapoWeY*u(pnqa%%
w
++Naikrapda^qhhapbnkipdaop]ca
naikra?deh`$[^qhhapoWeY%7
++Naikra^qhhapbnki]nn]u
[^qhhapo*olhe_a$e(-%7
++Oq^pn]_p-bnkipda_kqjpanpk_kilajo]pa
++bknpdanaikra`ahaiajp
e))7
++Ql`]papdank^kp#oo_kna
[nk^kpO_kna''7
++Ql`]papdank^kp#oo_kna`eolh]ukjpdaop]ca
nk^kpO_kna@eolh]u*patp9Opnejc$[nk^kpO_kna%7
y
^na]g7
_]oaop]n6
++?da_gbkn]_khheoekjsepdpdank^kp
eb$nk^kp*depPaopLkejp$[^qhhapoWeY*t([^qhhapoWeY*u(pnqa%%
w
++Naikrapda^qhhapbnkipdaop]ca
naikra?deh`$[^qhhapoWeY%7
 
Search Nedrilad ::




Custom Search