HTML and CSS Reference
In-Depth Information
Figure 9.12. You should be able to move your player around the screen now. We've moved him from between
“Geometry Destroyer” to the upper-left corner. Be warned: You can't shoot bullets with X yet.
Step 5: Create the player's bullets
Create bullets to shoot by appending the following listing after your
Player
entity. Your
player will shoot small triangles that destroy enemy entities on collision.
Bullet
s will
spawn at the
Player
's position when you pass in parameters through the
init()
meth-
od.
Listing 9.22. run.js—Making bullets