Đang chuẩn bị liên kết để tải về tài liệu:
Microsoft XNA Game Studio Creator’s Guide- P16

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

Microsoft XNA Game Studio Creator’s Guide- P16:The release of the XNA platform and specifically the ability for anyone to write Xbox 360 console games was truly a major progression in the game-programming world. Before XNA, it was simply too complicated and costly for a student, software hobbyist, or independent game developer to gain access to a decent development kit for a major console platform. | 428 MICROSOFT X N A GAME STUDIO CREATOR S GUIDE These next instructions belong inside LoadContent to load the spaceship model shipModel Content.Load Model Models alien1 shipMatrix new Matrix shipModel.Bones.Count shipModel.CopyAbsoluteBoneTransformsTo shipMatrix UpdateShipPosition is used in the game class to not only move the ship on X and Z but also Y to match the height of the terrain below void UpdateShipPosition GameTime gameTime const float HOVER_DISTANCE 0.04f ship s X Y Z position without hover distance above the ground shipPosition.Y shipPosition.Y - HOVER_DISTANCE reverse direction if right boundary exceeded if shipPosition.Z -BOUNDARY positiveDirection false shipVelocity -1.0f positiveDirection true reverse direction if left boundary exceeded else if shipPosition.Z BOUNDARY positiveDirection true shipVelocity -1.0f positiveDirection false increment position by time scale so speed is same on all systems float time float gameTime.ElapsedGameTime.Milliseconds 200.0f shipPosition.Z shipVelocity.Z time shipPosition.X shipVelocity.X time shipPosition.Y CellHeight shipPosition HOVER_DISTANCE To update the ship height each frame trigger the ship update at the end of the Up-date method UpdateShipPosition gameTime When drawing objects that use the terrain you need to do more than just update their positions and directions about the Y axis. You also need to update their orientation relative to the slope of the terrain where they are located. This next section of code allows you to do this. CHAPTER 25 When you re drawing the spaceship the ship s Up vector is calculated using a weighted average of leading and trailing normal vectors in the ship s path see Figure 25-5 . This weighted average prevents a jerking motion caused as the ship s Up vector changes from one cell to the next. If you want to make it look as if you don t have any shock absorption you can just use the normal vector for the current cell only. Whether you are calculating weighted or normal vectors a

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.