O'Reilly logo

GameMaker Cookbook by Brandon Gardiner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lighting objects with a spot light

In the previous recipe, we were able to illuminate an entire room with a perfectly even light with the push of a button. In this case, that button was the spacebar and not an actual light switch, but you get the idea, right? Now, what if you don't want to light up the entire room at once? What if you want to shine a light on a smaller area, leaving the rest of the room in cold, scary darkness? Well, you're in luck! Let's take a look at how to create a mouse-controlled spotlight to investigate a dark scene.

Getting ready

We're going to continue from the scene that we created previously, so if you haven't finished it, now would be a good time. You'll also need a spot light sprite (spr_spotLight), which should be ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required