1. Trang chủ
  2. » Công Nghệ Thông Tin

Microsoft XNA 4.0 Game Development Cookbook ppt

357 1,5K 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 357
Dung lượng 2,97 MB

Nội dung

[...]... If you are an XNA developer who has already successfully dabbled in some of the simple 2D and 3D functionality provided by XNA, and are eager to find out how to achieve some of the more advanced features presented in popular games, dive into the Microsoft XNA 4.0 Game Development Cookbook for an example-based approach that should have you safely on your way towards the next level of game creation You... your players can drag, drop, point, and type their way through your games Chapter 9, Networking: Expand your virtual world across to the real one by adding the ability to communicate What you need for this book To write games using the examples presented in this book, you'll need: ff Windows Vista (SP2) or later ff XNA Game Studio 4.0 (usually bundled as part of the Windows Phone SDK) or later For... environment, and for a lot of games written within the Reach profile, a simple static image of a dark patch beneath the character's feet is sufficient, as seen in the following illustration: There are, however, times where a non-descript blur isn't going to cut it, and a more realistic looking shadow is required This recipe will teach you how to create a detailed shadow of an in -game element, as seen in... Applying Special Effects 6 After drawing the game scene's floor, but prior to drawing the object to be shadowed, insert the following code to give the shadow transparency: graphicsDevice.BlendState = BlendState.AlphaBlend; graphicsDevice.DepthStencilState = DepthStencilState.DepthRead; 7 Drawing the object with the shadow effect will then render a shadow: gameObject.Draw(reachShadowEffect); 8 Setting... DepthStencilState.Default; gameObject.Draw(regularEffect); Downloading the example code You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com If you purchased this book elsewhere, you can visit http://www.packtpub com/support and register to have the files e-mailed directly to you How it works Utilizing one of the built-in transformations of the XNA framework,... HiDef profile's OcclusionQuery class can offer, this test can be beyond the processing resources available to a game (especially one running on either mobile or older hardware) The good news is that we do have a relatively cheap alternative that may just provide enough approximation for a game, and no one need be the wiser that the "proper" technique wasn't used, as the following illustration of the... the lens flare that are blocked by scenery: ShadowCaptureEffect = new BasicEffect(graphicsDevice) { DiffuseColor = Vector3.Zero, }; 9 Next, add an Update() method to the class: public void Update(GameTime gameTime, Matrix view, Matrix projection) { 10 Add in a check to determine if the lens flare is visible at all where the player is currently looking: view.Translation = Vector3.Zero; var projectedPosition... spriteBatch.End(); } 18 Next in our game code, we add an instance variable for the new lens flare: ReachLensFlare reachLensFlare; 19 Initialize an instance of the lens flare in the LoadContent() method: reachLensFlare = new ReachLensFlare(GraphicsDevice, Content); 22 Chapter 1 20 Inside the Draw() method, there are two parts The first part is where we draw the elements of the game scene which are likely to... target and blur in a similar fashion to the technique demonstrated in the Implementing lens flare within the Reach profile section of this chapter There's more… In the example, a simplified call to a game object's Draw() method was made, passing in the effect to be used in rendering If you're interested in how such a method might be constructed, sneak a peek at the Draw() method of the GeometricBuffer... huge amount of memory or processing power remains one of the great challenges in computer graphics While I may not be able to offer a perfect solution for every shadow-related problem you have in your games, I can at least get you started in the world of shadow creation through the demonstration of one of the more well-known techniques, shadow mapping, seen in the following illustration Getting ready .

Ngày đăng: 15/03/2014, 02:20

TỪ KHÓA LIÊN QUAN