This chapter continues the work of implementing the sample game, Invasion of the Slugwroths. In the previous chapter, you saw how to add Captain Chloride to a level. Because the world he existed in was nothing more than a background, our good Captain could walk right through doors and walls. In this chapter, I'll show you how to fix that. First, I'll explain how to use sprites to make the Captain bump into a door. Next, you'll learn how you can make Captain Chloride pick up keys. Finally, I'll demonstrate how to make the door open and close. If Captain Chloride doesn't have the key, the door won't open. If he does, it slides up to admit him inside.
|