In our preceding chapter, we covered the part where we successfully detected collisions. Now that we have understood how to deal with collisions, we can play around with our knowledge and add some cool stuff to our game. This chapter will be pretty concise, and if you have understood the concept of collision detection properly, then this will be a breeze for you. Here's what we will do in this chapter:
- Add a ground for our player as a boundary
- Detect a collision between our player and rocks
- Spawn an explosion sprite on the point where a collision takes place
Observe that from the preceding tasks, we have already accomplished our second task, so we have to focus on the first and third tasks. Let's dive into creating a ground for our player because right now our player is simply going down infinitely. We will also add an upper boundary in order to contain our player within the screen, otherwise, our player would go right outside...