tailieunhanh - Building XNA 2.0 Games- P12
Building XNA Games- P12: 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.) | 318 CHAPTER 10 MENUS A HUD AND DEPLOYMENT 1f - optionFrame i GetAlpha true 1f - optionFrame i new Vector2 160f 32f 1f 1f If we re not in dead mode draw the second layer of fog and foreground graphic if menuMode pan 2f for int i 0 i 2 i spritesTex fog i new Vector2 pan 0f new Rectangle i 4 64 0 64 64 new Color new Vector4 1f 1f 1f .1f GetAlpha false fog i .X fog i .Y 100f new Vector2 32f 32f float i 10 .5f 2f 1f poseForeTex new Vector2 - 480f 616f GetAlpha false float double frame 20f 20f - 480f 286f new Rectangle 0 0 616 286 new Color new Vector4 GetAlpha false GetAlpha false GetAlpha false 1f 0f new Vector2 480f 1f CHAPTER 10 MENUS A HUD AND DEPLOYMENT 319 Options Population Now let s take a look at our PopulateOptions method. It s just a bunch of cases again. The only odd bit is for the main level if we re in pause mode our main level will be a bit different than for the other modes. private void PopulateOptions for int i 0 i i option i switch level case if menuMode option 0 option 1 option 2 option 3 totalOptions 4 else option 0 option 1 option 2 option 3 totalOptions 4 break case option 0 totalOptions 1 break case option 0 option 1 totalOptions 2 break default totalOptions 0 break 320 CHAPTER 10 MENUS A HUD AND DEPLOYMENT Pausing and Dying We ll be using the Pause and Die methods from elsewhere in our game to set all of the appropriate flags to pause or go into you-are-dead mode. public void Pause menuMode .
đang nạp các trang xem trước