Game Development with Construct 2 by LEE STEMKOSKI & Evan Leider

Game Development with Construct 2 by LEE STEMKOSKI & Evan Leider

Author:LEE STEMKOSKI & Evan Leider
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


As it stands, the wizard’s animation continues, even when the wizard is not moving. Next, you will create events to start and stop the wizard animation at the appropriate times. First, create a new event with the condition Wizard - 8-Direction: Is moving, and add the action Wizard - Set animation, with Animation set to "Default". Next, you need to stop the animation when the wizard is not moving. You could do this with an event that has an inverted Is moving condition, as you did in Chapter 4, but instead, you will use the newly learned Else condition, which has the same effect in this situation. Create a new event with the condition System - Else, and add the action Wizard - Animation: Stop. Since the Else event is directly below the Is moving event, this event will activate exactly when the wizard is not moving. These events are also shown in Figure 9-3.

Finally, you will implement the game mechanic that causes the wizard to face in the direction of the mouse; this is often referred to as mouselook. This control scheme is common in first-person and top-down shooter games. First, add a Mouse object to the project. In the event sheet, create a new event with the condition System - Every tick, and then add the action Wizard - Rotate toward position, setting Degrees to 10,1 setting X to Mouse.X, and setting Y to Mouse.Y. When you are finished, this event should appear as in Figure 9-3. Save and test your game to check that when you move your mouse cursor around the game’s window, the wizard rotates and faces toward the location of the mouse cursor.



Loading...
Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.