tailieunhanh - Beginning Game Programming (phần 6)

Tham khảo tài liệu 'beginning game programming (phần 6)', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 230 Chapter 10 Handling Input Devices On Your Own The following exercises will challenge your retention of the information presented in this chapter. Exercise 1. Paddle Game featured a single ball bouncing on the screen with support for collision with the paddle. This is obviously just the start of what could become a great game. Add support for blocks that the ball can strike. When the ball hits a block the block should disappear and the ball should reverse direction. Exercise 2. In addition to adding blocks to make this a functional game add the logic to cause the player to lose when the ball hits the bottom edge of the screen. CHAPTER 1 1 Tile-Based ScROLLing BACkgROUNDS Most action and arcade games use the technique of tile-based scrolling to achieve the moving background you see in such games. Although this technique is now decades old it is still employed for rendering backgrounds and this style of 2D game is still used frequently today. Back in the old days when computer memory was very limited tile-based scrolling was used because it is very efficient. We take for granted multiple gigabytes of memory today but that much memory was unbelievable even in a hard drive let alone main memory RAM . The concept of a virtual screen buffer which you will learn about in this chapter was used with very limited video cards at the time with 256 to 1024 KB of video memory . Back then you would be very lucky to have two 320 x 240 screens or buffers let alone enough memory for a large scrolling world. This chapter focuses on creating tile-based backgrounds with scrolling using secondary buffers. As you will discover 231 232 Chapter 11 Tile-Based Scrolling Backgrounds this is far easier than trying to wrangle memory out of a video card as programmers were forced to do years ago. A memory buffer will work well with either full-screen or windowed mode. Here is a breakdown of the major topics in this chapter Introduction to scrolling. Creating tile-based backgrounds. Using a .