Microsoft® Small Basic Advanced Games Estimated time to complete this lesson: 1 hour
Advanced Games In this lesson, you will learn how to: Create advanced games by using basic elements, objects, and other advanced concepts of Small Basic.
Advanced Games in Small Basic Let’s see how we can use all these concepts in Small Basic to create advanced games. Congratulations! You are now well acquainted with programming fundamentals as well as advanced concepts of Small Basic. You have learned to use basic programming concepts in Small Basic. You have also been introduced to Small Basic objects and advanced concepts.
Tic-Tac-Toe – The Game You are familiar with the popular Tic-Tac-Toe game. Let’s see how we can create a Small Basic version of this popular game. Notice how you use the Shapes object to draw various game elements. You use mouse events to enable the user to place Xs on the graphics window. The user and the computer try to win the game by placing Xs or Os in a horizontal, vertical, or diagonal row before the other does.
Tic-Tac-Toe – How to Play So how do you play this game? Steps to play the game:
This game involves 2 players, the user and the computer. Each player takes a turn placing an X or an O on the 3x3 playing area. The game starts with the user placing an X on the board.
The players alternately place Xs and Os and on the playing area.
The player who first places three Xs or three Os in a horizontal, vertical, or diagonal line wins the game.
Tic-Tac-Toe – The Code Now let’s understand the code for the game in detail…
Use the GraphicsWindowto create the game interface.
Use the Shapes object to create the playing area for the Xs and Os on the graphics window.
Use mouse events and conditions like If-Else to describe various actions performed by the user and the computer during the game.
Let’s Summarize… Congratulations! Now you know how to: Create advanced games in Small Basic by using basic elements, objects, and advanced concepts of Small Basic.
It’s Time to Apply Your Learning… Create a game that involves the following objects: a wall of colored and grey blocks, a ball, and a paddle. The wall is slowly moving downwards, towards the paddle. Using the ball, you must get rid of all the colored blocks before the wall hits the paddle. You use the mouse to move the paddle; the paddle controls the movement of the ball. The ball will bounce off grey blocks. You win the game if you get rid of all the colored blocks. You lose the game if the paddle misses the ball or if the grey blocks hit the paddle before you can remove all the blocks.