tailieunhanh - Building XNA 2.0 Games- P7
Building XNA Games- P7: I would like to acknowledge John Sedlak, who saved this book from certain doom, as well as all of the great guys in the XNA community and Microsoft XNA team, who helped me with all of my stupid programming questions. (That is actually the term used—“stupid programming question”—and it is a question that one should not have to ask if one has been approached to write a book about the subject.) | CHAPTER 6 BRINGING IT TO THE GAME 167 Putting Scripting into Practice Let s look at how this scripting language actually works in a situation we could be using for Zombie Smashers XNA. We ve mapped out all of the important keyframes in the animation second for secondary attack and connected them with gotos in Figure 6-9. We ve left out frame numbers opting to use some attractive lines instead. setsecgoto Figure 6-9. Gotos in second It s all one animation but it s split into two rows that just happen to coincide with the regular shoot and shoot up animations. At the start of the animation we ll check whether Up was pressed. If it was we ll jump to the start of the shoot up segment. At the ends of both the regular shoot and shoot up animations we ll check for input to send us to the start of the shooting animations. If we don t get input we ll move to the end of the animation and finally idle. Let s look at a more complicated example for the animation attack shown in the same pseudo-format in Figure 6-10. Now we re getting into the good stuff We have got a four-hit combo spanner-whack spanner-whack spanner-whack flying kick. The player just needs to keep mashing those buttons. Of course if the player doesn t keep mashing the buttons each individual attack has a few back-to-idle frames so we have a totally legit combo now. The fun part is at the end. If the player does an uppercut Down on the left analog Y we ll jump to the last row launching skyward with a nice spanner-uppercut and finishing up in the fly animation. See how powerful this stuff is We can really go nuts with these combos air juggles complex ground combos far-reaching mega slams. We ve just opened up a really fun and exciting part of this whole design racket 168 CHAPTER 6 BRINGING IT TO THE GAME setanygoto setanim idle Figure 6-10. Complex stuff the attack animation Odds and Ends Cleanup Now that we have our script system in place and gotten all hot and bothered in the process we can clean up some .
đang nạp các trang xem trước