Moving the big rock – obj_Rock
Rock wrapping
Programming the collision between a bullet and a rock – From obj_rock perspective
Programming the collision between a bullet and a rock – From rock perspective
Importing spr_smallRock into Gamemaker
Introducing the logic for the rocks! - When a big rock becomes a small rock
To control the number of rocks in the room, we’ll only respawn a rock if there are less than 12 rocks in the room.
This will be done using a ”selection” or a “comparison condition” (a diamond shaped block) What is this diagram called? A flowchart The first "diamond" block of code checks if the rock is big, by checking its sprite. When a bullet hits it, If it hits a big rock, it’s changed into a small rock, and the instance is then copied so we get two small rocks. The second "diamond" block starts with “else”, so it only runs if the preceding condition is (no) false – meaning the rock is small. It checks if there are less than 12 rocks in the room, and if that's true, it changes the rock into a big rock. The final "Destroy" block only runs if the both preceding conditions are false, meaning the rock is small and there are already 12 or more rocks in the room. In that case, the rock is destroyed. |