tailieunhanh - Building XNA 2.0 Games- P8
Building XNA Games- P8: 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.) | 198 CHAPTER 7 PARTICLE MAYHEM AddParticle new Smoke loc -50f 50f -50f 10f - traj 1f 1f 1f 0 4 AddParticle new Smoke loc -50f 50f -50f 10f 0 4 We re making a bunch of dust here The first AddParticle call sends a bit of light smoke back in the direction the bullet came from albeit much slower and at a random speed . The second AddParticle creates a softer darker bit of smoke. Since we re doing 16 of each we get a soft spray of dust as shown in Figure 7-11 it looks better in motion obviously . Figure 7-11. Bullet ricochet CHAPTER 7 PARTICLE MAYHEM 199 Adding Zombies Shooting the earth is fun enough but what we really need here are some undead punching bags and not a moment too soon We re all the way to Chapter 7 with nary a monster in sight so without further ado let s make some zombies We need to start off with some graphics. We ll use a few new images torso2 .png and as shown in Figure 7-12. Figure 7-12. Zombie parts We ll add these images to the Content project in two solutions CharacterEditor and ZombieSmashers. We also need to upgrade CharacterEditor again to allow the user to specify which textures to use. Zombies in the Character Editor First we ll change the arrays as created in to contain two indices. Fortunately we don t need to change the loading because we coded it to automatically load the textures based on the length of the array. legsTex new Texture2D 2 torsoTex new Texture2D 2 headTex new Texture2D 2 weaponTex new Texture2D 1 Let s add a new tab to our low-budget triggers script tab area turning it into a triggers script textures tab area. We ll start by creating a new class-level constant const int AUX_SCRIPT 0 const int AUX_TRIGS 1 const int AUX_TEXTURES 2 Now we ll draw our texture-selection panel in Draw . We ll .
đang nạp các trang xem trước