Game Development Reference
In-Depth Information
14. Include a Start Block action.
15. Include a Test Variable action that tests if x is larger than obj_zool.x . In other words,
this is testing whether the Bee is to the right of Zool. If it is, then we want it to aim for a
target position just to the right of Zool.
16. Include a Set Variable action that sets targetx to obj_zool.x+32 .
17. Include an Else action.
18. Include a Set Variable action that sets targetx to obj_zool.x-32 .
19. Include a Test Variable action with point_distance(x,y,obj_zool.x,obj_zool.y) for
Variable , smaller than for Operation, and 256 for Value . Flying Bees have no physical
restrictions on their movement, but we don't want them to swarm in on Zool from all
over the map, so this makes sure they only react to him as he gets close.
20. Include a Step Avoiding action ( move tab) that steps toward the point X = targetx ,
Y = obj_zool.y , at a Speed of 10 and avoids all instances .
21. Include an End Block action ( control tab).
22. Include a Test Variable action that tests if x is larger than obj_zool.x (again).
23. Follow this w ith a Set Variable action that sets facing to FACE_LEFT .
24. Include an Else action.
25. Follow this with a Set Variable action that sets facing to FACE_RIGHT . This last set of
actions ensures that the Bee always faces Zool, even when hovering—adding to that
buzzing insect feel. There should now be 13 actions in the Step event for obj_bee , as
shown in Figure 5-10.
 
Search WWH ::




Custom Search