Adding screen-shake
One of my favorite effects, screen-shake, is a great way to add some depth and excitement to your game. As you may have guessed, I'm referring to the visual effects of making the screen-shake in order to simulate the effect of a shock or impact. Game developers, Vlambeer, know how to add excitement to games, such as Luftrausers and Nuclear Throne, by correlating the action with screen-shake; if you get hit or an explosion goes off, you'll know it. Let's see how we can add screen-shake using GameMaker.
Getting ready
Screen-shake often takes place when an explosion occurs on screen, making this recipe a perfect follow up to the previous one. Let's add on to the particle recipe using the same project file. In order to show off the effect, you'll need to add some visible objects to the background. This will allow you to see the screen moving back and forth. I added several instances of obj_block
, which has a simple 32 x 32 square for its sprite. There's no need to make changes...