Game Development Reference
In-Depth Information
39. Add an Alarm, Alarm 0 event and include a Check Object action to check if there
would NOT be a collision with an instance of obj_platform at a Relative position of
X = facing*16 , Y = 1 .
40. Follow this with a Set Variable action that sets the Variable facing to -facing . This
turns the Beastie around at the end of the wait or attack states if he has reached the
end of a platform.
41. Include a Check Object action to check if there would be a collision with an instance of
obj_enemy_limit at a Relative position of X = facing*16 , Y = 0 .
42. Follow this with a Set Variable action that sets the Variable facing to -facing .
43. Include a Set Variable action that sets the Variable state to ESTATE_MOVE .
Now place an instance of the Beastie in the room; the top of the second hill in front of the
start point seems like a good place (see Figure 5-8). When you run the game, you should observe
him walking back and forth along the top of his platform, pausing briefly to turn at each end and
sometimes just randomly pausing as well. This gives the impression that he is a little bit on edge
or is responding to something that the player might have done. We know it is just random
behavior, but players will often project human-like characteristics onto computer enemies in this
way. Next, we need to give this Beastie some teeth….
Figure 5-8. The Beastie enemy guarding the top of the hill
 
Search WWH ::




Custom Search