Skip Navigation LinksProgramming-Games-with-Visual-C--Table-Of-Contents

Table of Contents

 

1. Building Projects Using Visual C#

Preview 1-1
Introducing Programming Games With Visual C# 1-2
Requirements for Progrmming Games With Visual C#  1-3
Introducing Visual C#  1-4
Structure of a Visual C#  Project 1-6
Steps in Developing a Visual C# Project 1-8
Starting Visual C#  1-9
Visual C#  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 C#  Project 1-40
Running a Visual C# Project 1-42
Chapter Review 1-44

2. Overview of Visual C#  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
ListBox Control 2-21
PictureBox Control 2-23
ProgressBar Control 2-30
Timer Control 2-32
Random Number Object 2-34
SoundPlayer Object 2-36
Chapter Review 2-38

3. Overview of Visual C#  Programming

Review and Preview 3-1
A Brief History of C# 3-2
Rules of C# Programming 3-3
Variables 3-4
Visual C# Data Types 3-5
Variable Declaration 3-7
Arrays 3-10
Constants 3-11
Variable Initialization 3-12
Intellisense Feature 3-13
Visual C# Statements and Expressions 3-14
Type Casting 3-16
Visual C# Arithmetic Operators 3-18
Comparison and Logical Operators 3-20
Concatenation Operators 3-22
String Functions 3-23
Math Functions 3-28
Visual C#  Decisions - If Statements 3-30
Switch - Another Way to Branch 3-35
Visual C#  Looping 3-38
Visual C#  Counting 3-41
Chapter Review 3-43

4. Debugging a Visual C#  Project

Review and Preview 4-1
Errors in Visual C#  Projects 4-2
Debugging Visual C# Projects 4-3
Opening a Visual C#  Project 4-6
Debugging Example 4-8
Using the Debugging Tools 4-10
Writing to the Output Window 4-11
Breakpoints 4-13
Viewing Variables in the Locals Window 4-16
Viewing Variables in the Watch Window 4-18
Call Stack Window 4-19
Single Stepping (Step Into) an Application 4-20
Procedure Stepping (Step Over) 4-22
Procedure Exit (Step Out) 4-23
Debugging Strategies 4-24
Project Design Considerations 4-25
Chapter Review 4-26

5. Safecracker Project

Review and Preview 5-1
Safecracker Project Preview 5-2
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-38
Code Design – Adding Sounds 5-43
Safecracker Game Project Review 5-50
Safecracker Game Project Enhancements 5-51

6. Tic Tac Toe Project

Review and Preview 6-1
Tic Tac Toe Project Preview 6-2
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-40
Code Design – Random Computer Moves 6-41
Code Design – Smart Computer Moves 6-46
Code Design – Adding Sounds 6-50
Tic Tac Toe Game Project Review 6-57
Tic Tac Toe Game Project Enhancements 6-58

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-51
Code Design – Computer Moves 7-57
Code Design – Random Computer 7-65
Code Design – Smart Computer 7-69
Match Game Project Review 7-81
Match Game Project Improvements 7-82

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-29
Code Design – Phone Orders 8-35
Code Design – Pizza Oven 8-41
Code Design – Load Car 8-53
Code Design – Move Car 8-57
Code Design – Deliveries 8-73
Multiple Form Visual C#  Applications 8-82
Form Design – Sales Results 8-86
Code Design – Sales Results 8-95
Pizza Delivery Game Project Review 8-103
Pizza Delivery Game Project Improvements 8-104

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-36
Remaining Work 9-45
Code Design – Landing Pad Distances 9-46
Code Design – Landing Detection 9-54
Code Design – Pilot Levels and Sounds 9-60
Graphics Methods 9-74
Graphics Object 9-75
Colors 9-78
Pen Object 9-80
DrawLine Method 9-81
Code Design – Trajectory Display, Suggested Path 9-82
Rectangle Structure 9-88
DrawEllipse Method 9-90
Code Design – Trajectory Display, Actual Path 9-91
DrawImage Method – Scrolling Background 9-95
Code Design – Scrolling Landscape 9-96
Sprite Animation 9-106
Code Design – Lander Animation 9-109
Code Design – Autopilot 9-117
Moon Landing Game Project Review 9-130
Moon Landing Game Project Improvements 9-131

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-60
Collision Detection 10-73
Code Design – Vehicle Collisions 10-76
Code Design – Snake Collisions 10-79
Code Design – Log Collisions 10-82
Code Design – Home Collisions 10-89
Code Design – Game Levels 10-103
Code Design – Scoring 10-114
Form Design – High Scores 10-121
Code Design – Displaying High Scores 10-131
Code Design – Saving High Scores 10-134
Code Design – Reading High Scores 10-138
Code Design – Adding to High Scores 10-141
Leap Frog Game Project Review 10-152
Leap Frog Game Project Enhancements 10-153