Game Development Reference
In-Depth Information
Figure 12-3. (Left): The new script will check for walls in two different positions (marked in red). (Right):
Unlike most of Flynn's animations, the climbing animation will
not take place “on the spot” but will show
Flynn moving in space and then his position will be moved at the end of the animation (blue arrow)
6.
Next, we're going to write a new script resource that provides a consistent way of
detecting walls that Flynn can climb. At the moment, the game contains a number of
subtly different checks for walls in various situations and none of them cope well with
larger characters. We will replace all of these with calls to a single script that will make
sure there are sections of wall adjacent to Flynn at both hand and foot heights at the
same time (see Figure 12-3, left). Only when both are present will we allow Flynn to
hold onto a wall; otherwise, his climbing animation looks a little odd. Create a new
script resource called is_climbable and carefully type the following code into it:
 
Search WWH ::




Custom Search