Skip Navigation LinksProgrammingKidGameswithVisualBasicExpressTableofContents

Programming Games With Visual Basic Express

Table of Contents

 

 

1. Building Projects Using Visual Basic Express

Preview 1-1
Introducing Kid Games With Visual Basic Express 1-2
Requirements for Kid Games With Visual Basic Express 1-3
Introducing Visual Basic Express 1-4
Structure of a Visual Basic Express Project 1-6
Steps in Developing a Visual Basic Express Project 1-8
Starting Visual Basic Express 1-9
Visual Basic Express Integrated Development Environment (IDE) 1-10
Drawing the User Interface 1-19
Setting Properties of Controls at Design Time 1-22
Setting Properties at Run Time 1-27
How Names are Used in Control Events 1-28
Use of the Form Name Property 1-29
Writing Code 1-31
Saving a Visual Basic Express Project 1-36
Running a Visual Basic Express Project 1-38
Chapter Review 1-40

2. Overview of Visual Basic Express Objects

Review and Preview 2-1
Form Object 2-2
Button Control 2-5
Label Control 2-7
TextBox Control 2-9
CheckBox Control 2-12
RadioButton Control 2-14
GroupBox Control 2-16
Panel Control 2-19
ScrollBar Controls 2-21
PictureBox Control 2-25
OpenFileDialog Control 2-27
Timer Control 2-30
Random Number Object 2-29
SoundPlayer Object 2-33
Kid Games Objects 2-35
Chapter Review 2-38

3. Overview of Visual Basic Express Programming

Review and Preview 3-1
A Brief History of BASIC 3-2
Variables 3-3
Visual Basic Express Data Types 3-4
Variable Declaration 3-5
Arrays 3-8
Constants 3-9
Variable Initialization 3-10
Intellisense Feature 3-11
Visual Basic Express Statements and Expressions 3-12
Type Checking 3-14
Visual Basic Express Arithmetic Operators 3-15
Comparison and Logical Operators 3-17
Concatenation Operators 3-19
Visual Basic Express Functions 3-20
String Functions 3-21
String Class Methods 3-25
Math Functions 3-29
Visual Basic Express Decisions - If Statements 3-31
Select Case - Another Way to Branch 3-34
Visual Basic Express Looping 3-36
Visual Basic Express Counting 3-40
Chapter Review 3-42

4. Debugging a Visual Basic Express Project

Review and Preview 4-1
Errors in Visual Basic Express Projects 4-2
Debugging Visual Basic Express Projects 4-3
Opening a Visual Basic Express Project 4-5
Debugging Example 4-7
Using the Debugging Tools 4-9
Writing to the Immediate Window 4-10
Breakpoints 4-12
Viewing Variables in the Locals Window 4-15
Viewing Variables in the Watch Window 4-17
Call Stack Window 4-18
Single Stepping (Step Into) an Application 4-19
Procedure Stepping (Step Over) 4-21
Procedure Exit (Step Out) 4-22
Debugging Strategies 4-23
Project Design Considerations 4-24
Chapter Review 4-25

5. Safecracker Project

Review and Preview 5-1
Safecracker Project Preview 5-3
Safecracker Form Design 5-10
Code Design – Initializing Stopped State 5-18
Code Design – Stopped to Playing State 5-21
Code Design – Playing to Stopped State 5-24
Code Design – Generating Secret Combination 5-26
Handling Multiple Events in a Single Event Procedure 5-30
Code Design – Accepting Player Input 5-33
Code Design – Checking Player Input 5-37
Code Design – Adding Sounds 5-42
Safecracker Game Project Review 5-49
Safecracker Game Project Enhancements 5-50

6. Tic Tac Toe Project

Review and Preview 6-1
Tic Tac Toe Project Preview 6-3
Tic Tac Toe Form Design 6-10
Code Design – Initializing Stopped State 6-19
Code Design – Stopped to Playing State 6-22
Code Design – Playing to Stopped State 6-25
Code Design – Marking Grid 6-27
Using General Functions in Projects 6-30
Code Design – Checking for Win 6-33
Code Design – Number of Players Selection 6-39
Code Design – Random Computer Moves 6-40
Code Design – Smart Computer Moves 6-45
Code Design – Adding Sounds 6-48
Tic Tac Toe Game Project Review 6-55
Tic Tac Toe Game Project Enhancements 6-56

7. Match Game Project

Review and Preview 7-1
Match Game Project Preview 7-2
Match Game Form Design 7-10
Form Design – Photo Selection 7-23
Code Design – Initializing Stopped State 7-27
Code Design – Integer Shuffling 7-33
Code Design – Stopped to Playing to Stopped State 7-37
Code Design – Displaying Photos 7-43
Code Design – One Player, Solitaire Game 7-50
Code Design – Computer Moves 7-55
Code Design – Random Computer 7-62
Code Design – Smart Computer 7-66
Match Game Project Review 7-77
Match Game Project Improvements 7-78

8. Pizza Delivery Project

Review and Preview 8-1
Pizza Delivery Project Preview 8-2
Pizza Delivery Form Design 8-11
Adding Controls at Run-Time 8-22
Form Design – Building Delivery Grid 8-24
Code Design – Initializing Stopped State 8-28
Code Design – Clock 8-30
Code Design – Phone Orders 8-36
Code Design – Pizza Oven 8-41
Code Design – Load Car 8-52
Code Design – Move Car 8-56
Code Design – Deliveries 8-71
Multiple Form Visual Basic Express Applications 8-79
Form Design – Sales Results 8-82
Code Design – Sales Results 8-91
Pizza Delivery Game Project Review 8-98
Pizza Delivery Game Project Improvements 8-99

9. Moon Landing Project

Review and Preview 9-1
Moon Landing Project Preview 9-2
Moon Landing Form Design 9-13
Code Design – Initializing Options, Clock 9-26
Code Design – Physics of Moon Landing 9-35
Remaining Work 9-44
Code Design – Landing Pad Distances 9-45
Code Design – Landing Detection 9-52
Code Design – Pilot Levels and Sounds 9-58
Graphics Methods 9-70
Graphics Object 9-71
Colors 9-74
Pen Object 9-76
DrawLine Method 9-77
Code Design – Trajectory Display, Suggested Path 9-78
Rectangle Structure 9-84
DrawEllipse Method 9-86
Code Design – Trajectory Display, Actual Path 9-87
DrawImage Method – Scrolling Background 9-91
Code Design – Scrolling Landscape 9-92
Sprite Animation 9-102
Code Design – Lander Animation 9-106
Code Design – Autopilot 9-114
Moon Landing Game Project Review 9-127
Moon Landing Game Project Improvements 9-128

10. Leap Frog Project

Review and Preview 10-1
Leap Frog Project Preview 10-2
Game Design – Prelude to Form Design 10-11
Leap Frog Form Design 10-14
Introduction to Object-Oriented Programming (OOP) 10-21
Code Design – Sprite Class, Properties 10-23
DrawImage Method 10-26
Brush Object 10-27
FillRectangle Method 10-28
Code Design – Sprite Class, Methods 10-29
Code Design – Road Panel 10-32
Code Design – River Panel 10-45
Code Design – Snake Panel 10-53
Code Design – Moving the Frog 10-59
Collision Detection 10-72
Code Design – Vehicle Collisions 10-75
Code Design – Snake Collisions 10-78
Code Design – Log Collisions 10-81
Code Design – Home Collisions 10-88
Code Design – Game Levels 10-101
Code Design – Scoring 10-112
Form Design – High Scores 10-119
Code Design – Displaying High Scores 10-129
Code Design – Saving High Scores 10-132
Code Design – Reading High Scores 10-136
Code Design – Adding to High Scores 10-139
Leap Frog Game Project Review 10-151
Leap Frog Game Project Enhancements 10-152