|
Author
|
||||
|
Related articles
|
||||
|
More in Development
|
||||
Now place the Light object into the room, close to your Wall. For added effect, remove or comment out the directional light code from the Camera, so that the Light provides the only illumination in the room. Then, run the game!
Two final notes before we finish up: Firstly, if you redefine an existing light, you can change its strength, position and colour. So, for example, if we placed the following in our Light's Step event;
d3d_light_define_point(id,x,y,0,random(96),c_aqua);
we will have a flickering light that changes its strength every frame. Additionally, if you were to change the x and y positions of the Light object, this code would also synchronise the defined light with the Light object's new position, so you can have lighting that tracks certain objects.
Finally, if you decide that you don't want an object to be influenced by lighting, you can disable lighting by using the d3d_set_lighting() command. You'll remember that we used it in our Camera object to enable lights. You can also use it to disable lighting for particular objects, just as was done for backface culling on the wall. Just remember to re-enable it again, otherwise some of your other objects may not be influenced by lighting either.
This concludes Part 2. In Part 3, we'll look at drawing point sprites and billboards, as well as show you how to go about creating a heads-up-display for your game.
|
Words from the readers
|
||||
|
No comments posted for this article yet. Have something to say? Make yourself heard below.
Have your say:
|
||||