Programming Games
with Microsoft Small Basic
TABLE OF CONTENTS
1. Writing Programs Using Small Basic
Preview 1-1
Introducing Kid Games With Small Basic 1-2
Requirements for Kid Games With Small Basic 1-3
Introducing Small Basic 1-4
Starting Small Basic 1-5
Running a Small Basic Program 1-7
Chapter Review 1-10
2. Overview of Small Basic Objects
Review and Preview 2-1
Objects, Properties, Methods and Events 2-2
TextWindow Object 2-4
GraphicsWindow Object 2-5
Controls Object 2-7
Program Object 2-8
Text Object 2-8
Mouse Object 2-9
ImageList Object 2-10
Shapes Object 2-11
File Object 2-12
Timer Object 2-12
Sound Object 2-13
Chapter Review 2-14
3. Overview of Small Basic Programming
Review and Preview 3-1
A Brief History of BASIC 3-2
Variables 3-3
Small Basic Data Types 3-4
Arrays 3-5
Intellisense Feature 3-6
Small Basic Statements and Expressions 3-7
Small Basic Arithmetic Operators 3-8
Comparison and Logical Operators 3-9
Concatenation Operator 3-10
Small Basic Methods 3-11
String Methods 3-12
Math Methods 3-14
Random Numbers 3-16
Graphics Methods 3-17
Small Basic Decisions – If Statements 3-21
Small Basic Looping 3-24
Small Basic Counting 3-28
Small Basic Subroutines 3-30
Chapter Review 3-32
4. Debugging a Small Basic Program
Review and Preview 4-1
5. Safecracker Program
Review and Preview 5-1
Safecracker Project Preview 5-3
Game Window Design 5-10
Safecracker Window Design 5-11
Window Design – Draw Safe 5-13
Window Design – Display Combination Digits 5-15
Window Design – Results Area 5-17
Code Design – Initializing Stopped State 5-18
Code Design – Stopped to Playing State 5-22
Code Design – Playing to Stopped State 5-24
Code Design – Generating Secret Combination 5-26
Code Design – Accepting Player Input 5-29
Code Design – Checking Player Input 5-32
Code Design – Adding Sounds 5-36
Safecracker Game Program Listing 5-42
Safecracker Game Project Review 5-48
Safecracker Game Project Enhancements 5-49
6. Tic Tac Toe Program
Review and Preview 6-1
Tic Tac Toe Program Preview 6-2
Tic Tac Toe Window Design 6-11
Window Design – Message Area 6-12
Window Design – Draw Grid 6-14
Window Design – Add Buttons 6-15
Code Design – Initializing Stopped State 6-16
Code Design – Stopped to Playing State 6-23
Code Design – Playing to Stopped State 6-26
Code Design – Marking Grid 6-28
Code Design – Checking for Win 6-33
Code Design – Random Computer Moves 6-36
Code Design – Smart Computer Moves 6-41
Code Design – Adding Sounds 6-45
Tic Tac Toe Game Program Listing 6-50
Tic Tac Toe Game Program Review 6-59
Tic Tac Toe Game Program Enhancements 6-60
7. Match Game Program
Review and Preview 7-1
Match Game Program Preview 7-2
Match Game Window Design 7-11
Window Design – Draw Picture Boxes 7-13
Window Design – Scores 7-15
Window Design – Message Area 7-17
Window Design – Add Buttons 7-19
Code Design – Initializing Stopped State 7-20
Code Design – Adding Photos 7-29
Code Design – Integer Shuffling 7-32
Code Design – Stopped to Playing to Stopped State 7-36
Code Design – Displaying Photos 7-41
Code Design – One Player, Solitaire Game 7-52
Code Design – Computer Moves 7-58
Code Design – Random Computer 7-65
Code Design – Smart Computer 7-68
Match Game Program Listing 7-79
Match Game Program Review 7-91
Match Game Program Improvements 7-92
8. Pizza Delivery Program
Review and Preview 8-1
Pizza Delivery Program Preview 8-2
Pizza Delivery Window Design 8-11
Window Design – Building Delivery Grid 8-13
Window Design – Clock and Sales Display 8-17
Window Design – Message Area 8-19
Window Design – Pizza Oven 8-20
Window Design – Pizza Loading Boxes 8-22
Window Design – Remaining Buttons 8-24
Code Design – Initializing Stopped State 8-25
Code Design – Clock 8-27
Code Design – Phone Orders 8-36
Code Design – Pizza Oven 8-46
Code Design – Load Car 8-58
Code Design – Move Car 8-63
Code Design – Deliveries 8-75
Window Design – Sales Results 8-87
Code Design – Sales Results 8-88
Pizza Delivery Program Listing 8-100
Pizza Delivery Game Program Review 8-118
Pizza Delivery Game Program Improvements 8-119
9. Moon Landing Program
Review and Preview 9-1
Moon Landing Program Preview 9-2
Moon Landing Window Design 9-11
Window Design – Lander Viewer 9-13
Window Design – Status Display 9-15
Window Design – Trajectory Display 9-19
Window Design – Add Buttons 9-21
Code Design – Initial Steps 9-26
Code Design – Starting, Clock Display 9-36
Code Design – Physics of Moon Landing 9-42
Remaining Work 9-51
Code Design – Landing Pad Distances 9-52
Code Design – Landing Detection 9-58
Code Design – Pilot Levels and Sounds 9-65
Code Design – Trajectory Display, Suggested Path 9-76
Code Design – Trajectory Display, Actual Path 9-80
Code Design – Lander Animation 9-84
Code Design – Adding Thrust 9-94
Code Design – Displaying Pad 9-100
Code Design – Autopilot 9-104
Moon Landing Game Program Listing 9-116
Moon Landing Game Program Review 9-131
Moon Landing Game Program Improvements 9-132
Appendix I. Small Basic Colors
Appendix II. Sharing a Small Basic Program