September 2010
Beginner
384 pages
8h 49m
English
Because the needs of our game have changed, we might reconsider how and where our code is written. In The Break-Up, it made sense for the player character to detect all collisions. But in Shoot the Moon, all the significant collisions actually happen on the enemy ship. The enemy ship has to know when it hits the hero ship, and it needs to know when it hits a bullet. So we can actually localize all of the collision code on the enemy ship. This makes a lot of sense, so let's make that change by transplanting some code.
OnCollisionEnter function.As we did with the ResetPosition() function, ...
Read now
Unlock full access