Game Development Reference
In-Depth Information
Implementing Lighting Special Effects
LightFX are known as special effects with lighting. They are commonly used in
video games to add more interactivity or enhance the player experience.
You can start directly at this stage by opening the file Labyrinth-
step1.gameproj .
I will show you a very cool trick now. This is what I call ''The light is off.'' Imagine
the labyrinth game with only a small amount of light around the ball; the scene is
completely dark. Of course the light will have to follow the ball and you will
discover the area via the ball. If you already have a labyrinth game for iOS, you
know that this is a common feature.
The trick is very simple. You will use a black image with a transparent disk at its
center. The size of the disk depends on how difficult you want to make the
game. Also, the size of the image should be twice the size of the scene. The
center of the disk will be constrained to the position of the ball. With this size,
the entire scene will be covered wherever the ball is going.
You will use some game attribute in order to store the position of the ball.
Create two game attributes named ''BallX'' and ''BallY.''
Open the Ball actor in the Actor Editor. Drag and drop a Constrain Attribute
behavior and change game.BallX to Ball.Position.X. Repeat the same operation
with BallY and Position.Y as per Figure 8-18.
Figure 8-18. Constraining the ball
Import the image named Light Off.png located in the Chapter_8 folder. Create
a new actor and drag and drop the image on the new actor. Rename the actor
''Light_Off.''
Open the actor in the Actor Editor and drag and drop a Constrain Attribute
behavior with the settings ''Light_Off.position.X'' ''game.BallX.'' Repeat the
operation with Light_Off.position.Y and game.BallY.
 
Search WWH ::




Custom Search