Dorf

Páginas: 18 (4409 palabras) Publicado: 5 de diciembre de 2011
Simple Computer Games
Using Java
Dr. Brian C. Ladd
Dr. Jam Jenkins

Contents
Contents i
1 Getting Started: What’s in a Game? 1
1.1 Learning From Simple Computer Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 What’s In a Game? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Active and Passive: Rules Followers . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.4 Running a Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.5 Strategies: Winning a Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.6 What is in a Computer Program? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.7 Summary . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2 Designing Your First Program 25
2.1 BasketBall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.2 Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.3 Creating Executable Programs . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . 35
2.4 FANG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.5 Finishing Up BasketBall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3 FANG: A Survey of Classes53
3.1 How Computers Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.2 FANG Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
3.3 Examining a Public Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
3.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . 86
4 Deciding What Happens: if 93
4.1 A Simplest Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.2 Computer Program (Game) Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
4.3 Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
4.4Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
4.5 Finishing NewtonsApple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
4.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
5 Components: Names, Types, Expressions 121
5.1 Randomness in a Game . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5.2 One More Sprite: CompositeSprite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
5.3 Java Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
5.4 Finishing EasyDice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
5.5Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
i
ii CONTENTS
6 Rules: Methods, Parameters, and Design 159
6.1 A Simple Arcade Game: SoloPong . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
6.2 Top-down Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
6.3 Delegation:Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
6.4 Expressions Redux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
6.5 Finishing Up SoloPong . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
6.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Dorf
  • Dorf Analisis De Circuitos
  • El manual del emprendedor de Steve Blank y Bob Dorf

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS