TAILIEUCHUNG - Java Programming for absolute beginner- P22
Java Programming for absolute beginner- P22:Hello and welcome to Java Programming for the Absolute Beginner. You probably already have a good understanding of how to use your computer. These days it’s hard to find someone who doesn’t, given the importance of computers in today’s world. Learning to control your computer intimately is what will separate you from the pack! By reading this book, you learn how to accomplish just that through the magic of programming. | 2 25 03 8 57 AM Page 378 378 k o c c a a The Project The Block Game o The Block Game is similar in concept to the well-known Tetris game owned by o the Tetris Company and originally developed by Alexey Pajitnov. The Block Game j project in this book is for learning purposes only and can t truly compare to the actual Tetris game. 0 When you run the game a window pops up with a black play area on the left side and some scoring information on the right side. The Play Reset button also appears on the right you click it to start a new game. When you click the button blocks start falling from the top of the black play area one at a time. There are seven shapes of blocks each consisting of four squares. As the blocks fall you can move them left and right and also rotate them clockwise and counter-clockwise using the key commands shown in Table . The goal is to complete rows of squares. When squares completely fill horizontal rows of the play area those rows f lash and then disappear. Any blocks that are above the cleared rows fall down to fill up the vacated space. The game is over when no more blocks can fall into the play area because the existing blocks are in the way. Figure shows how the game looks. Building the Block Class The blocks that fall into the play area of the Block Game application are what you directly have control of when you play. The blocks themselves consist of a specific orientation of squares that form one of seven shapes. You can flip the blocks around and the blocks can land on other blocks so the blocks need to have some Table Block Game Controls Key Command Action Left arrow Moves block to the left. Right arrow Moves block to the right. Down arrow Makes block drop down faster. Up arrow or X Rotates block clockwise one quarter turn. Ctrl or Z Rotates block counter-clockwise one quarter turn. J team Line - live informative Non-cost and Genuine Please purchase PDF Split-Merge on to remove this .
đang nạp các trang xem trước