TAILIEUCHUNG - microsoft visual basic game programming for teens phần 6

Để làm cho sprite hoàn toàn vô hình, sử dụng & H0. ■ Để làm cho ma một phần mờ, sử dụng các giá trị từ & H11111111 & HFFFFFFFF. Ví dụ, 50% mờ & H88888888 và được thể hiện trong hình 9,6. Nếu bạn thấy khó khăn này thảo luận về số thập lục phân, không lo lắng về nó! Hãy nhớ rằng, bất cứ điều gì bạn không hiểu | 180 Chapter 9 Core Technique Drawing Sprites To make the sprite totally invisible use H0. To make the sprite partially translucent use values from H11111111 to HFFFFFFFF. For example 50-percent translucent is H88888888 and is shown in Figure . If you found this discussion of hexadecimal numbers daunting don t worry about it Remember whatever you don t understand now eventually comes through experience. Just try to experiment with different hex values in the SpriteTest program to see the results. That is where the science in computer science comes in. tip I put sprite translucency to good use in Chapter 18 Engaging In Combat with NPCs by causing an enemy character to fade away when killed and it looks really neat. Sprite Scaling Another fascinating effect you can use in your games with the help of Direct3D sprites the ability to scale the sprite by any value from to about . Keep in mind that you Figure Drawing the sprite with partial translucency makes it see-through. Level Up 181 must not draw outside the border of the screen or the program could crash. The DrawSprite subroutine that you saw earlier had support for scaling using the ScaleFactor variable in TSPRITE. Refer to the definition of TSPRITE earlier in this chapter see the section titled The Sprite Handler Structure . ScaleFactor is declared as a Single data type which is a floating-point number with a decimal place. By default InitSprite sets ScaleFactor to . You can change the scale factor at any time by just accessing it in your sprite. Here is an example Calling DrawSprite with this sprite then draws it with a scaling factor of 200 percent Take a look at Figure to see the tavern sprite drawn with a scale factor of . Level Up This chapter provided an introduction to sprites. You learned how to use a Direct3D texture to draw a transparent sprite on the screen. You learned how to create a basic sprite Figure Changing the scale factor of the sprite makes it

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.