0% found this document useful (0 votes)
8 views

Full download Game Programming with Unity and C#: A Complete Beginner’s Guide 1st Edition Casey Hardman pdf docx

The document promotes the ebook 'Game Programming with Unity and C#: A Complete Beginner’s Guide' by Casey Hardman, available for download on ebookmeta.com. It includes links to additional recommended digital products related to game development and other subjects. The document also provides an overview of the book's content, including installation, Unity basics, and programming concepts.

Uploaded by

sugaimandepy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Full download Game Programming with Unity and C#: A Complete Beginner’s Guide 1st Edition Casey Hardman pdf docx

The document promotes the ebook 'Game Programming with Unity and C#: A Complete Beginner’s Guide' by Casey Hardman, available for download on ebookmeta.com. It includes links to additional recommended digital products related to game development and other subjects. The document also provides an overview of the book's content, including installation, Unity basics, and programming concepts.

Uploaded by

sugaimandepy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Get the full ebook with Bonus Features for a Better Reading Experience on ebookmeta.

com

Game Programming with Unity and C#: A Complete


Beginner’s Guide 1st Edition Casey Hardman

https://ebookmeta.com/product/game-programming-with-unity-
and-c-a-complete-beginners-guide-1st-edition-casey-hardman/

OR CLICK HERE

DOWLOAD NOW

Download more ebook instantly today at https://ebookmeta.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Game Programming with Unity and C#: A Complete Beginner’s


Guide 1st Edition Casey Hardman

https://ebookmeta.com/product/game-programming-with-unity-and-c-a-
complete-beginners-guide-1st-edition-casey-hardman/

ebookmeta.com

Advanced Unity Game Development: Build Professional Games


with Unity, C#, and Visual Studio Victor G Brusca

https://ebookmeta.com/product/advanced-unity-game-development-build-
professional-games-with-unity-c-and-visual-studio-victor-g-brusca/

ebookmeta.com

Advanced Unity Game Development: Build Professional Games


with Unity, C#, and Visual Studio 1st Edition Victor G
Brusca
https://ebookmeta.com/product/advanced-unity-game-development-build-
professional-games-with-unity-c-and-visual-studio-1st-edition-victor-
g-brusca-2/
ebookmeta.com

Dreams and Lives in Ottoman Istanbul A Seventeenth Century


Biographer s Perspective 19 Birmingham Byzantine and
Ottoman Studies 1st Edition Asli Niyazioglu
https://ebookmeta.com/product/dreams-and-lives-in-ottoman-istanbul-a-
seventeenth-century-biographer-s-perspective-19-birmingham-byzantine-
and-ottoman-studies-1st-edition-asli-niyazioglu/
ebookmeta.com
The Law of Disclosure: A Perennial Problem in Criminal
Justice (Routledge Contemporary Issues in Criminal Justice
and Procedure) 1st Edition Ed Johnston
https://ebookmeta.com/product/the-law-of-disclosure-a-perennial-
problem-in-criminal-justice-routledge-contemporary-issues-in-criminal-
justice-and-procedure-1st-edition-ed-johnston/
ebookmeta.com

Intermediate Microeconomics with Calculus A Modern


Approach Media Update 1st Edition Hal R. Varian

https://ebookmeta.com/product/intermediate-microeconomics-with-
calculus-a-modern-approach-media-update-1st-edition-hal-r-varian/

ebookmeta.com

Zelensky A Biography 1st Edition Serhii Rudenko

https://ebookmeta.com/product/zelensky-a-biography-1st-edition-serhii-
rudenko/

ebookmeta.com

Choreographing Intersubjectivity in Performance Art:


Transforming Subjects (New World Choreographies) Victoria
Wynne-Jones
https://ebookmeta.com/product/choreographing-intersubjectivity-in-
performance-art-transforming-subjects-new-world-choreographies-
victoria-wynne-jones/
ebookmeta.com

Alien Intrigue Gate Ghosts Book 6 S H Jucha

https://ebookmeta.com/product/alien-intrigue-gate-ghosts-book-6-s-h-
jucha/

ebookmeta.com
Golden Years of Australian Radio Astronomy An Illustrated
History 1st Edition Wayne Orchiston

https://ebookmeta.com/product/golden-years-of-australian-radio-
astronomy-an-illustrated-history-1st-edition-wayne-orchiston/

ebookmeta.com
Game
Programming
with Unity and C#
A Complete Beginner’s Guide

Casey Hardman
Game Programming
with Unity and C#
A Complete Beginner’s Guide

Casey Hardman
Game Programming with Unity and C#

Casey Hardman
West Palm Beach, FL, USA

ISBN-13 (pbk): 978-1-4842-5655-8     ISBN-13 (electronic): 978-1-4842-5656-5 


https://doi.org/10.1007/978-1-4842-5656-5

Copyright © 2020 by Casey Hardman


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Spandana Chatterjee
Development Editor: James Markham
Coordinating Editor: Divya Modi
Cover designed by eStudioCalamar
Cover image designed by Pixabay
Distributed to the book trade worldwide by Springer Science+Business Media New York, 1 New York Plaza,
New York, NY 10004. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or
visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is
Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware
corporation.
For information on translations, please e-mail [email protected], or visit http://www.apress.com/
rights-permissions.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales
web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub via the book’s product page, located at www.apress.com/978-1-4842-5655-8. For more
detailed information, please visit http://www.apress.com/source-code.
Printed on acid-free paper
Table of Contents
About the Author�����������������������������������������������������������������������������������������������������xv

About the Technical Reviewer�������������������������������������������������������������������������������xvii


Introduction������������������������������������������������������������������������������������������������������������xix

Chapter 1: Installation and Setup����������������������������������������������������������������������������� 1


Installing Unity������������������������������������������������������������������������������������������������������������������������������ 1
Installing Our Code Editor������������������������������������������������������������������������������������������������������������� 4
Creating a Project������������������������������������������������������������������������������������������������������������������������� 7
Summary�������������������������������������������������������������������������������������������������������������������������������������� 9

Chapter 2: Unity Basics������������������������������������������������������������������������������������������ 11


Windows������������������������������������������������������������������������������������������������������������������������������������� 11
Project Window��������������������������������������������������������������������������������������������������������������������������� 12
Scene Window���������������������������������������������������������������������������������������������������������������������������� 13
Hierarchy Window����������������������������������������������������������������������������������������������������������������������� 14
Inspector Window����������������������������������������������������������������������������������������������������������������������� 14
Components�������������������������������������������������������������������������������������������������������������������������������� 14
Adding GameObjects������������������������������������������������������������������������������������������������������������������� 17
Summary������������������������������������������������������������������������������������������������������������������������������������ 20

Chapter 3: Manipulating the Scene������������������������������������������������������������������������ 21


Transform Tools��������������������������������������������������������������������������������������������������������������������������� 21
Positions and Axes���������������������������������������������������������������������������������������������������������������������� 23
Making a Floor���������������������������������������������������������������������������������������������������������������������������� 24
Scale and Unit Measurements���������������������������������������������������������������������������������������������������� 24
Summary������������������������������������������������������������������������������������������������������������������������������������ 26

iii
Table of Contents

Chapter 4: Parents and Their Children�������������������������������������������������������������������� 29


Child GameObjects���������������������������������������������������������������������������������������������������������������������� 29
World vs. Local Coordinates�������������������������������������������������������������������������������������������������������� 32
A Simple Building������������������������������������������������������������������������������������������������������������������������ 33
Pivot Points��������������������������������������������������������������������������������������������������������������������������������� 36
Summary������������������������������������������������������������������������������������������������������������������������������������ 39

Chapter 5: Prefabs�������������������������������������������������������������������������������������������������� 41
Making and Placing Prefabs������������������������������������������������������������������������������������������������������� 41
Editing Prefabs���������������������������������������������������������������������������������������������������������������������������� 42
Overriding Values������������������������������������������������������������������������������������������������������������������������ 44
Nested Prefabs���������������������������������������������������������������������������������������������������������������������������� 48
Prefab Variants���������������������������������������������������������������������������������������������������������������������������� 49
Summary������������������������������������������������������������������������������������������������������������������������������������ 50

Chapter 6: Programming Primer���������������������������������������������������������������������������� 53


Programming Languages and Syntax����������������������������������������������������������������������������������������� 53
What Code Does�������������������������������������������������������������������������������������������������������������������������� 54
Strong vs. Weak Typing��������������������������������������������������������������������������������������������������������������� 55
File-Type Extensions������������������������������������������������������������������������������������������������������������������� 57
Scripts����������������������������������������������������������������������������������������������������������������������������������������� 57
Summary������������������������������������������������������������������������������������������������������������������������������������ 59

Chapter 7: Code Blocks and Methods��������������������������������������������������������������������� 61


Statements and Semicolons������������������������������������������������������������������������������������������������������� 61
Code Blocks�������������������������������������������������������������������������������������������������������������������������������� 61
Comments����������������������������������������������������������������������������������������������������������������������������������� 63
Methods�������������������������������������������������������������������������������������������������������������������������������������� 64
Calling Methods�������������������������������������������������������������������������������������������������������������������������� 67
Basic Data Types������������������������������������������������������������������������������������������������������������������������� 69
Returning Values with Methods�������������������������������������������������������������������������������������������������� 69
Declaring Methods���������������������������������������������������������������������������������������������������������������������� 70

iv
Table of Contents

Operators������������������������������������������������������������������������������������������������������������������������������������ 73
Summary������������������������������������������������������������������������������������������������������������������������������������ 75

Chapter 8: Conditions��������������������������������������������������������������������������������������������� 77
The “if” Block������������������������������������������������������������������������������������������������������������������������������ 77
Overloads������������������������������������������������������������������������������������������������������������������������������������ 79
Enums����������������������������������������������������������������������������������������������������������������������������������������� 80
The “else” Block������������������������������������������������������������������������������������������������������������������������� 81
The “else if” Block���������������������������������������������������������������������������������������������������������������������� 82
Operators for Conditions������������������������������������������������������������������������������������������������������������� 83
Equality Operators����������������������������������������������������������������������������������������������������������������� 83
Greater Than and Less Than�������������������������������������������������������������������������������������������������� 85
Or������������������������������������������������������������������������������������������������������������������������������������������� 85
And���������������������������������������������������������������������������������������������������������������������������������������� 86
Summary������������������������������������������������������������������������������������������������������������������������������������ 86

Chapter 9: Working with Objects���������������������������������������������������������������������������� 87


Classes���������������������������������������������������������������������������������������������������������������������������������������� 87
Variables�������������������������������������������������������������������������������������������������������������������������������� 89
Accessing Class Members����������������������������������������������������������������������������������������������������� 90
Instance Methods������������������������������������������������������������������������������������������������������������������ 93
Declaring Constructors���������������������������������������������������������������������������������������������������������� 95
Using the Constructor������������������������������������������������������������������������������������������������������������ 98
Static Members��������������������������������������������������������������������������������������������������������������������� 99
Summary���������������������������������������������������������������������������������������������������������������������������������� 101

Chapter 10: Working with Scripts������������������������������������������������������������������������ 103


Usings and Namespaces����������������������������������������������������������������������������������������������������������� 104
Script Class������������������������������������������������������������������������������������������������������������������������������� 105
Rotating a Transform����������������������������������������������������������������������������������������������������������������� 107
Frames and Seconds���������������������������������������������������������������������������������������������������������������� 109
Attributes���������������������������������������������������������������������������������������������������������������������������������� 110
Summary���������������������������������������������������������������������������������������������������������������������������������� 112

v
Table of Contents

Chapter 11: Inheritance���������������������������������������������������������������������������������������� 113


Inheritance in Action: RPG Items����������������������������������������������������������������������������������������������� 113
Declaring Our Classes��������������������������������������������������������������������������������������������������������������� 115
Constructor Chaining���������������������������������������������������������������������������������������������������������������� 118
Subtypes and Casting��������������������������������������������������������������������������������������������������������������� 122
Number Value Types������������������������������������������������������������������������������������������������������������������ 124
Type Checking��������������������������������������������������������������������������������������������������������������������������� 126
Virtual Methods������������������������������������������������������������������������������������������������������������������������� 127
Summary���������������������������������������������������������������������������������������������������������������������������������� 128

Chapter 12: Debugging����������������������������������������������������������������������������������������� 129


Setting Up the Debugger����������������������������������������������������������������������������������������������������������� 129
Breakpoints������������������������������������������������������������������������������������������������������������������������������� 131
Using Unity’s Documentation���������������������������������������������������������������������������������������������������� 135
Summary���������������������������������������������������������������������������������������������������������������������������������� 137

Part I: Obstacle Course���������������������������������������������������������������������� 139


Chapter 13: Obstacle Course Design and Outline������������������������������������������������� 141
Gameplay Overview������������������������������������������������������������������������������������������������������������������ 142
Technical Overview������������������������������������������������������������������������������������������������������������������� 143
Player Controls�������������������������������������������������������������������������������������������������������������������� 143
Death and Respawn������������������������������������������������������������������������������������������������������������ 145
Levels���������������������������������������������������������������������������������������������������������������������������������� 145
Level Selection�������������������������������������������������������������������������������������������������������������������� 146
Obstacles����������������������������������������������������������������������������������������������������������������������������� 146
Project Setup���������������������������������������������������������������������������������������������������������������������������� 146
Summary���������������������������������������������������������������������������������������������������������������������������������� 148

Chapter 14: Player Movement������������������������������������������������������������������������������ 149


Player Setup������������������������������������������������������������������������������������������������������������������������������ 150
Materials and Colors����������������������������������������������������������������������������������������������������������������� 152
Declaring Our Variables������������������������������������������������������������������������������������������������������������� 155

vi
Table of Contents

Properties���������������������������������������������������������������������������������������������������������������������������������� 158
Tracking the Velocity����������������������������������������������������������������������������������������������������������������� 159
Applying the Movement������������������������������������������������������������������������������������������������������������ 166
Summary���������������������������������������������������������������������������������������������������������������������������������� 170

Chapter 15: Death and Respawning��������������������������������������������������������������������� 173


Enabling and Disabling������������������������������������������������������������������������������������������������������������� 174
Death Method���������������������������������������������������������������������������������������������������������������������������� 177
Respawn Method���������������������������������������������������������������������������������������������������������������������� 178
Summary���������������������������������������������������������������������������������������������������������������������������������� 180

Chapter 16: Basic Hazards����������������������������������������������������������������������������������� 181


Collision Detection�������������������������������������������������������������������������������������������������������������������� 181
Hazard Script���������������������������������������������������������������������������������������������������������������������������� 188
Projectile Script������������������������������������������������������������������������������������������������������������������������� 190
Shooting Script������������������������������������������������������������������������������������������������������������������������� 194
Summary���������������������������������������������������������������������������������������������������������������������������������� 197

Chapter 17: Walls and Goals��������������������������������������������������������������������������������� 199


Walls����������������������������������������������������������������������������������������������������������������������������������������� 199
Goals����������������������������������������������������������������������������������������������������������������������������������������� 201
Build Settings for Scenes���������������������������������������������������������������������������������������������������������� 204
Summary���������������������������������������������������������������������������������������������������������������������������������� 207

Chapter 18: Patrolling Hazards����������������������������������������������������������������������������� 209


Resembling a Patrol Point��������������������������������������������������������������������������������������������������������� 209
Arrays���������������������������������������������������������������������������������������������������������������������������������������� 210
Setting Up Patrol Points������������������������������������������������������������������������������������������������������������ 212
Detecting Patrol Points������������������������������������������������������������������������������������������������������������� 216
The “for” Loop��������������������������������������������������������������������������������������������������������������������� 218
Sorting Patrol Points����������������������������������������������������������������������������������������������������������������� 221
Moving the Patroller������������������������������������������������������������������������������������������������������������������ 226
Summary���������������������������������������������������������������������������������������������������������������������������������� 229

vii
Table of Contents

Chapter 19: Wandering Hazards��������������������������������������������������������������������������� 233


Wander Regions������������������������������������������������������������������������������������������������������������������������ 233
A Basic Editor Extension����������������������������������������������������������������������������������������������������������� 236
Editor Scripts����������������������������������������������������������������������������������������������������������������������� 236
Custom Inspectors��������������������������������������������������������������������������������������������������������������� 237
Accessing the Inspector Target������������������������������������������������������������������������������������������� 237
Drawing to the Scene���������������������������������������������������������������������������������������������������������� 238
Wanderer Setup������������������������������������������������������������������������������������������������������������������������ 240
Wanderer Script������������������������������������������������������������������������������������������������������������������������ 241
Handling the State��������������������������������������������������������������������������������������������������������������� 243
Reacting to the State����������������������������������������������������������������������������������������������������������� 245
Summary���������������������������������������������������������������������������������������������������������������������������������� 247

Chapter 20: Dashing��������������������������������������������������������������������������������������������� 249


Dashing Variables��������������������������������������������������������������������������������������������������������������������� 249
Dashing Method������������������������������������������������������������������������������������������������������������������������ 251
Final Touches���������������������������������������������������������������������������������������������������������������������������� 254
Dash Cooldown������������������������������������������������������������������������������������������������������������������������� 255
Summary���������������������������������������������������������������������������������������������������������������������������������� 257

Chapter 21: Designing Levels������������������������������������������������������������������������������� 259


Prefabs and Variants����������������������������������������������������������������������������������������������������������������� 259
Making Levels��������������������������������������������������������������������������������������������������������������������������� 261
Adding Walls����������������������������������������������������������������������������������������������������������������������������� 263
Level View Camera�������������������������������������������������������������������������������������������������������������������� 264
Summary���������������������������������������������������������������������������������������������������������������������������������� 264

Chapter 22: Menus and UI������������������������������������������������������������������������������������ 267


Scene Flow������������������������������������������������������������������������������������������������������������������������������� 267
Level Selection Script��������������������������������������������������������������������������������������������������������������� 269
Summary���������������������������������������������������������������������������������������������������������������������������������� 276

viii
Table of Contents

Chapter 23: In-Game Pause Menu������������������������������������������������������������������������ 279


Freezing Time���������������������������������������������������������������������������������������������������������������������������� 279
Summary���������������������������������������������������������������������������������������������������������������������������������� 284

Chapter 24: Spike Traps���������������������������������������������������������������������������������������� 285


Designing the Trap�������������������������������������������������������������������������������������������������������������������� 285
Raising and Lowering��������������������������������������������������������������������������������������������������������������� 289
Writing the Script���������������������������������������������������������������������������������������������������������������������� 290
Adding Collisions����������������������������������������������������������������������������������������������������������������������� 295
Summary���������������������������������������������������������������������������������������������������������������������������������� 297

Chapter 25: Obstacle Course Conclusion�������������������������������������������������������������� 299


Building the Project������������������������������������������������������������������������������������������������������������������� 299
Player Settings�������������������������������������������������������������������������������������������������������������������������� 301
Recap���������������������������������������������������������������������������������������������������������������������������������������� 303
Additional Features������������������������������������������������������������������������������������������������������������������� 304
Summary���������������������������������������������������������������������������������������������������������������������������������� 306

Part II: Tower Defense������������������������������������������������������������������������ 307


Chapter 26: Tower Defense Design and Outline���������������������������������������������������� 309
Gameplay Overview������������������������������������������������������������������������������������������������������������������ 309
Technical Overview������������������������������������������������������������������������������������������������������������������� 311
Project Setup���������������������������������������������������������������������������������������������������������������������������� 313
Summary���������������������������������������������������������������������������������������������������������������������������������� 313

Chapter 27: Camera Movement���������������������������������������������������������������������������� 315


Setting Up��������������������������������������������������������������������������������������������������������������������������������� 315
Arrow Key Movement���������������������������������������������������������������������������������������������������������������� 318
Applying Movement������������������������������������������������������������������������������������������������������������������ 320
Mouse Dragging������������������������������������������������������������������������������������������������������������������������ 322
Zooming������������������������������������������������������������������������������������������������������������������������������������ 324
Summary���������������������������������������������������������������������������������������������������������������������������������� 325

ix
Table of Contents

Chapter 28: Enemies, Towers, and Projectiles������������������������������������������������������ 327


Layers and Physics������������������������������������������������������������������������������������������������������������������� 327
Basic Enemies��������������������������������������������������������������������������������������������������������������������������� 329
Projectiles��������������������������������������������������������������������������������������������������������������������������������� 333
Targeters����������������������������������������������������������������������������������������������������������������������������������� 339
Towers��������������������������������������������������������������������������������������������������������������������������������������� 348
Arrow Towers���������������������������������������������������������������������������������������������������������������������������� 351
Summary���������������������������������������������������������������������������������������������������������������������������������� 359

Chapter 29: Build Mode���������������������������������������������������������������������������������������� 361


UI Basics����������������������������������������������������������������������������������������������������������������������������������� 362
The RectTransform�������������������������������������������������������������������������������������������������������������������� 366
Building Our UI�������������������������������������������������������������������������������������������������������������������������� 368
Events��������������������������������������������������������������������������������������������������������������������������������������� 373
Setting Up��������������������������������������������������������������������������������������������������������������������������������� 374
Build Mode Logic���������������������������������������������������������������������������������������������������������������������� 379
The Dictionary��������������������������������������������������������������������������������������������������������������������������� 385
OnClick Event Methods������������������������������������������������������������������������������������������������������������� 388
Summary���������������������������������������������������������������������������������������������������������������������������������� 395

Chapter 30: Play Mode����������������������������������������������������������������������������������������� 397


Spawn and Leak Points������������������������������������������������������������������������������������������������������������ 397
Locking the Play Button������������������������������������������������������������������������������������������������������������ 399
Pathfinding Setup��������������������������������������������������������������������������������������������������������������������� 401
Finding a Path��������������������������������������������������������������������������������������������������������������������������� 404
Play Mode Setup����������������������������������������������������������������������������������������������������������������������� 409
Spawning Enemies������������������������������������������������������������������������������������������������������������������� 414
Enemy Movement��������������������������������������������������������������������������������������������������������������������� 417
Summary���������������������������������������������������������������������������������������������������������������������������������� 423

x
Table of Contents

Chapter 31: More Tower Types����������������������������������������������������������������������������� 425


Arcing Projectiles���������������������������������������������������������������������������������������������������������������������� 425
Cannon Tower��������������������������������������������������������������������������������������������������������������������������� 431
Hot Plates���������������������������������������������������������������������������������������������������������������������������������� 435
Barricades��������������������������������������������������������������������������������������������������������������������������������� 437
Summary���������������������������������������������������������������������������������������������������������������������������������� 437

Chapter 32: Tower Defense Conclusion���������������������������������������������������������������� 439


Inheritance�������������������������������������������������������������������������������������������������������������������������������� 439
UI����������������������������������������������������������������������������������������������������������������������������������������������� 441
Raycasting�������������������������������������������������������������������������������������������������������������������������������� 441
Pathfinding�������������������������������������������������������������������������������������������������������������������������������� 442
Additional Features������������������������������������������������������������������������������������������������������������������� 442
Health Bars�������������������������������������������������������������������������������������������������������������������������� 442
Types for Armor and Damage���������������������������������������������������������������������������������������������� 443
More Complex Pathing�������������������������������������������������������������������������������������������������������� 443
Range Indicators����������������������������������������������������������������������������������������������������������������� 444
Upgrading Towers���������������������������������������������������������������������������������������������������������������� 445
Summary���������������������������������������������������������������������������������������������������������������������������������� 445

Part III: Physics Playground�������������������������������������������������������������� 447


Chapter 33: Physics Playground Design and Outline�������������������������������������������� 449
Feature Outline������������������������������������������������������������������������������������������������������������������������� 449
Camera�������������������������������������������������������������������������������������������������������������������������������� 449
Player Movement����������������������������������������������������������������������������������������������������������������� 450
Pushing and Pulling������������������������������������������������������������������������������������������������������������� 450
Moving Platforms���������������������������������������������������������������������������������������������������������������� 451
Swings��������������������������������������������������������������������������������������������������������������������������������� 451
Force Fields and Jump Pads����������������������������������������������������������������������������������������������� 451
Project Setup���������������������������������������������������������������������������������������������������������������������������� 451
Summary���������������������������������������������������������������������������������������������������������������������������������� 452

xi
Table of Contents

Chapter 34: Mouse-Aimed Camera����������������������������������������������������������������������� 453


Player Setup������������������������������������������������������������������������������������������������������������������������������ 453
How It Works����������������������������������������������������������������������������������������������������������������������������� 454
Script Setup������������������������������������������������������������������������������������������������������������������������������ 456
Hotkeys������������������������������������������������������������������������������������������������������������������������������������� 463
Mouse Input������������������������������������������������������������������������������������������������������������������������������ 464
First-Person Mode�������������������������������������������������������������������������������������������������������������������� 469
Third-Person Mode������������������������������������������������������������������������������������������������������������������� 470
Testing�������������������������������������������������������������������������������������������������������������������������������������� 474
Summary���������������������������������������������������������������������������������������������������������������������������������� 475

Chapter 35: Advanced 3D Movement������������������������������������������������������������������� 477


How It Works����������������������������������������������������������������������������������������������������������������������������� 477
Player Script������������������������������������������������������������������������������������������������������������������������������ 480
Movement Velocity�������������������������������������������������������������������������������������������������������������������� 486
Applying Movement������������������������������������������������������������������������������������������������������������������ 490
Losing Velocity�������������������������������������������������������������������������������������������������������������������������� 493
Gravity and Jumping����������������������������������������������������������������������������������������������������������������� 494
Summary���������������������������������������������������������������������������������������������������������������������������������� 496

Chapter 36: Wall Jumping������������������������������������������������������������������������������������ 497


Variables����������������������������������������������������������������������������������������������������������������������������������� 497
Detecting Walls������������������������������������������������������������������������������������������������������������������������� 499
Performing the Jump���������������������������������������������������������������������������������������������������������������� 502
Summary���������������������������������������������������������������������������������������������������������������������������������� 505

Chapter 37: Pulling and Pushing�������������������������������������������������������������������������� 507


Script Setup������������������������������������������������������������������������������������������������������������������������������ 507
FixedUpdate������������������������������������������������������������������������������������������������������������������������������ 511
Target Detection������������������������������������������������������������������������������������������������������������������������ 513
Pulling and Pushing������������������������������������������������������������������������������������������������������������������ 515

xii
Table of Contents

Cursor Drawing������������������������������������������������������������������������������������������������������������������������� 517


Summary���������������������������������������������������������������������������������������������������������������������������������� 518

Chapter 38: Moving Platforms������������������������������������������������������������������������������ 519


Scene Setup������������������������������������������������������������������������������������������������������������������������������ 520
Platform Movement������������������������������������������������������������������������������������������������������������������ 522
Player Platforming�������������������������������������������������������������������������������������������������������������������� 529
Summary���������������������������������������������������������������������������������������������������������������������������������� 532

Chapter 39: Joints and Swings����������������������������������������������������������������������������� 533


Swing Setup������������������������������������������������������������������������������������������������������������������������������ 533
Connecting the Joints��������������������������������������������������������������������������������������������������������������� 540
Finishing Touches��������������������������������������������������������������������������������������������������������������������� 542
Summary���������������������������������������������������������������������������������������������������������������������������������� 543

Chapter 40: Force Fields and Jump Pads������������������������������������������������������������� 545


Script Setup������������������������������������������������������������������������������������������������������������������������������ 545
Force Field Setup���������������������������������������������������������������������������������������������������������������������� 547
Adding Velocity to the Player���������������������������������������������������������������������������������������������������� 548
Applying Forces������������������������������������������������������������������������������������������������������������������������ 549
Summary���������������������������������������������������������������������������������������������������������������������������������� 552

Chapter 41: Conclusion����������������������������������������������������������������������������������������� 553


Physics Playground Recap�������������������������������������������������������������������������������������������������������� 553
Further Learning for Unity��������������������������������������������������������������������������������������������������������� 555
The Asset Store������������������������������������������������������������������������������������������������������������������� 555
Terrains�������������������������������������������������������������������������������������������������������������������������������� 555
Coroutines��������������������������������������������������������������������������������������������������������������������������� 556
Script Execution Order��������������������������������������������������������������������������������������������������������� 556
Further Learning for C#������������������������������������������������������������������������������������������������������������� 557
Delegates����������������������������������������������������������������������������������������������������������������������������� 557
Documentation Comments�������������������������������������������������������������������������������������������������� 558
Exceptions��������������������������������������������������������������������������������������������������������������������������� 560

xiii
Table of Contents

Advanced C#����������������������������������������������������������������������������������������������������������������������������� 562


Operator Overloading���������������������������������������������������������������������������������������������������������� 562
Conversions������������������������������������������������������������������������������������������������������������������������� 562
Generic Types���������������������������������������������������������������������������������������������������������������������� 563
Structs��������������������������������������������������������������������������������������������������������������������������������� 563
Summary���������������������������������������������������������������������������������������������������������������������������������� 563

Index��������������������������������������������������������������������������������������������������������������������� 565

xiv
Other documents randomly have
different content
The telegram was certainly a work of art and ingenuity, and it
took art and ingenuity to understand it, with no punctuation marks
and some words evidently invented by a despairing operator in a
quandary over Madeline’s perfectly illegible handwriting. But the
general drift was that Madeline had been “on the way to” utter
despair,—because the heroine of her novel insisted on eloping with
the villain instead of the hero—when she thought of making a story
out of Patricia’s long-lost letters from “R.” While she was waiting for
her effort to come back to her, as usual, she scribbled off a college
tale about a girl who had a desk with a secret drawer and didn’t
know it. The first story was accepted—and paid for—by the
magazine that had been the goal of her ambitions all winter, and the
other had brought her a contract for a dozen college stories to be
written within a year, on terms that made a true Bohemian like
Madeline feel fairly dizzy with sudden wealth.
This splendid sequel to the hunt for Eugenia’s theme reminded
Betty of the papers which had filled her drawer, and which, in the
rush of other excitements, she had quite forgotten. If they had
anything to do with Patricia and “R.” perhaps Madeline might write a
sequel to her first story and score another triumph. But examination
proved that the nearest name to Patricia mentioned in them was
prosaic Peter, and the only “R.” a Robert Wales who signed one of
the papers in the minor rôle of witness for Peter’s signature. Betty
was interested at discovering her surname; but prosy old documents
make dull reading, even if witnessed by a possible ancestor.
However, she finally sent them to Madeline, for, as she told Georgia
Ames, you never can tell what a literary person will see in the most
commonplace things.
Of course Madeline was overjoyed at the happy outcome of the
Tally-ho’s crisis, and so was Babbie, who appeared in Harding with
the very earliest signs of spring.
“Florida was duller than ever this year,” she told Betty. “I’ve left
mother in Washington waiting for really warm weather, and I’ve come
to see about my branch of the Tally-ho. I’m sure it needs my
personal attention. Mr. Thayer certainly ought to give the poor
stocking-makers ice-cream for staying in and learning their lessons
now that it’s getting to be nice weather. You’re not a bit enterprising
about working up business through the night-school, Betty.”
“I have to leave that to you,” Betty told her solemnly. “The regular
affairs of the tea-shop, and Mr. Morton, are all that I can manage.
The ploshkins will be here to-morrow in full force, and Mr. Morton
has written to know if we can’t think of some small improvements
that can be made next week during the spring vacation. He can’t
bear to wait until summer for everything.”
“As if this place wasn’t just about perfect now!” said Babbie
scornfully.
But Mary Brooks, appearing in the midst of the discussion, took a
different view. “You’ve got to keep making them sit up and take
notice of something new over and over and over,” she announced.
“That’s business. The ploshkins will do for one thing, but if the
Morton millions are fairly languishing to be wasted on this property,
you ought to be able to think of some features to spend them on.
Just wait a minute—I have it—a tea-garden! Pagoda effects
scattered over the side yard. Lattice work, and thatched roofs,
Japanese screens to keep out the sun and the stares of the gaping
crowd, and lanterns for evenings. I’m sure it would take.”
“It’s commonplace compared to what I’ve thought of,” declared
Babbie proudly. “What we want is a Peter Pan Annex in our elm
trees. I presume you’ve never been to the original Café Robinson,
Mary, but we have, and it’s way beyond any tea-garden.”
Betty was in the window, peering out at the Harding elm trees.
“We could,” she declared. “I always wondered how those two
trees happened to be so close together, and now it seems like fate
that they’re exactly right for a Café Robinson.”
“And easily tall enough for three stories,” cried Babbie, joining
her.
“We mustn’t forget the big one-two-three signs for the stories,”
chimed in Betty excitedly.
“Nor the basket to pull up with the extra things,” added Babbie.
“We’ll tell Nora to have some extra things in every order so they
can all have the fun of hauling up the basket.”
“The view will be perfectly lovely from the top,” declared Babbie.
“And isn’t it fine that our trees are in such a sheltered place, behind
the little white house?”
Betty nodded. “If Bob were here she’d shin up to the top this very
minute and tell us what you can see.”
“But Babe will surely say she likes the second story best,
because she and John made up their quarrel in the second story,”
laughed Babbie; and then they settled down to telling the bewildered
Mary about the house-in-the-trees café that they had discovered
near Paris, and how the going-away party held there for Madeline
had developed into an announcement party for Babe. And of course
Mary agreed that a Peter Pan Annex was the only thing for the Tally-
ho Tea-Shop.
“And as Madeline won’t let me call my night-school a branch of
the business, I shall write her how I thought up this,” Babbie
declared. “I will also hunt up that comical carpenter that Madeline
had such times with last fall, and show him how to build it.”
Now carpentry and the supervision of carpentry are no work for a
woman; and the Tally-ho’s trees were in plain sight from Mr. Thayer’s
office windows. So it was only natural, when Babbie’s slender figure
appeared on the lawn for the purpose of supervision, that Mr. Thayer
should join her for the purpose of applying an understanding
masculine intelligence and a firm masculine will to the direction of
the thickest-headed carpenter imaginable. Babbie had a careless
fashion of running out on the rawest day without a wrap. This made it
all the more necessary for Mr. Thayer to come over, bringing his
sweater to throw across her shoulders.
“I saw your Cousin Austin at Palm Beach,” Babbie had explained
shortly after her arrival in Harding, “and then at St. Augustine. At
Miami he took us on the loveliest cruise, and I drove his car at sixty
miles an hour on the beach at Ormond. It was ripping fun. Not many
men will risk your losing your head and smashing them up.”
“And don’t you ever lose your head?” inquired Mr. Thayer blandly.
“Not over your Cousin Austin,” said Babbie, with a flash of a
smile.
After that Mr. Thayer came oftener and stayed longer. Babbie
assured Betty and Emily Davis that they had no idea how
complicated a Peter Pan Annex seemed to an untraveled carpenter
of Harding.
“We’re so afraid it won’t have the real French air,” she said.
“That’s why we spend such ages in staring at it from all possible
angles.”
“And then it must be perfectly secure,” she explained on another
occasion, just after she and Mr. Thayer had sat for almost an hour in
the top story, among the branches that now made a most beautiful
feathery screen. “Think how horrible it would be if the railing was too
low and some silly little freshman fell out, or if the floor wasn’t strong
enough and gave way. Mr. Thayer knows all about such things. He’s
taking a lot of interest. We never could have done it properly except
for him.”
But in spite of the accommodating slowness and stupidity of the
untraveled carpenter, the Peter Pan Annex was finished at last.
“I’m a candidate now for the Perfect Patron’s Society,” Mr. Thayer
told Betty, “so I want to give an opening-day tea up on the top floor
for all the owners, managers, assistant managers, and small sisters.
It’s to be this afternoon at four. I also want another stocking factory
party, and hadn’t we better get it off our hands early, before
commencement begins to loom up ahead?” Mr. Thayer looked very
hard at Betty. “I suppose you are terribly busy?”
“Terribly,” returned Betty gravely, “but I think Babbie will help.”
Babbie would not.
“I’m going to your Cousin Austin’s Adirondack camp,” she
explained, “to see spring come in the woods. Mother is the
chaperon, and I have an awful suspicion that I am a sort of guest of
honor. Anyway, the spring part of it appeals to me. And secondly,
mother has been solemnly promised a reunion with her long-lost
daughter.”
Later in the day Babbie, in a kimono, which is the attire of
confidential intercourse, complained that “Mummy was as bad as
Margot about a multi-millionaire,” and that she hated the woods in
spring; they were always hot, and smoky from forest fires, there was
no shade and no shooting, and the canoes leaked from being dry all
winter.
“Moreover,” added Babbie wearily, a “so-called camp, with a
butler and three other men, and a sunken garden, is going too much
for me. But when mummy really insists, the laws of the Medes and
Persians aren’t in it.” She gave a funny little mirthless laugh. “I
suppose one ought to be very sure that one isn’t foolishly prejudiced
against the popular idea of the idle rich.”
So Emily planned the factory party with much energy and
originality, and Mr. Thayer was duly grateful. But his rare smile came
only when Betty showed him a note from Babbie, inquiring carefully
about the date of the party and stating in a postscript, with vehement
underlining, that she never wanted to see spring come in anybody’s
woods again.
“There are mosquitoes, and other things much worse,” ended
Babbie enigmatically, with the blackest possible lines under the last
two words.
“Suppose you let me write her about the date of the party?”
suggested Mr. Thayer. “Then you needn’t bother.”
Evidently the change in correspondents did not displease Babbie
seriously, for she was back on the appointed day, with a bewitching
smile, flashed out from beneath a bewitching hat, for all her stocking
factory friends, including Mr. Thayer. The party was a sort of spring
fête held out on the grounds of the factory, in the late afternoon and
early evening. There were folk dances in costume, national songs,
and old-country games. Emily had made all the guests feel a
tremendous pride in doing whatever they could to entertain the rest,
and everything, from the Irish bag-pipe music to the Russian
mazurkas, went off with great spirit.
It was while Jimmie O’Ferrel was dancing a jig with all his might
and main, and with all eyes fastened upon his flying feet, that Betty,
happening to glance across the grounds, saw a bewitching hat slip
swiftly from the fence top down on the tea-shop side. But she had no
proof that Mr. Thayer was concerned in the disappearance of the
hat, until the smallest sister sought her out importantly, a little later.
“Do you want to know what I think?” she asked. “Well, I think
Babbie and Mr. Thayer are in love.”
“Why do you think that?” asked Betty laughingly.
“Because,” explained Dorothy, “I ran up in the Peter Pan Annex
just now to see how small people look ’way down here from ’way up
there, and I jumped ’most out of my skin ’cause there those two sat.
They never saw me at all, and he had his arm around her and she
didn’t care. She was smiling about it. So I came straight away. Was
that right?”
“Of course,” laughed Betty. “You hadn’t been invited.”
“I was invited to Mr. Thayer’s party, though,” objected Dorothy,
“and now he isn’t here. He’s over at our house. That’s queer.”
Up in the Peter Pan Annex Mr. Thayer was saying to Babbie, “I
must go back before any one misses me.”
“I can’t go back,” said Babbie sadly. “I tore my dress dreadfully
getting over the fence. You shouldn’t have made me do it.”
“I didn’t make you,” retorted Mr. Thayer. “I particularly advised
you to go around.”
“Exactly,” agreed Babbie, “and that made me want to go over.
Dear me! Do you suppose we shall ever really quarrel on account of
my not wanting to give in to your chin?”
“No, because I shall always want to give in to yours,” Mr. Thayer
told her.
“But I shouldn’t let you give in always,” declared Babbie. “I should
take turns giving in.”
“Don’t say ‘should,’” objected Mr. Thayer. “Say ‘shall.’ Haven’t we
settled it?”
“Of course.” Babbie gave a comical little sigh. “It feels so queer to
be settled—and so very nice. Now go back to your party, and I’ll get
Nora to lend me some pins so I can go back too. Oh, and we’ll tell
Betty, shan’t we, right away?”
Under the circumstances Betty wasn’t extremely surprised, but
she was extremely pleased.
“Now our tea-room is as successful as the famous one that
belonged to the cousins of the girl who lives over Mrs. Bob,” she
laughed. “It has produced an engagement, and a literary career to
match the artist person’s.”
Babbie frowned. “You mustn’t leave yourself out, Betty. You’re
mixed up in everything, and I don’t believe that other tea-room was
half as nice as this or made half as much money.”
“Neither do I,” agreed Betty happily. “I’m perfectly satisfied with
my profits, though they’re not so extraordinary as yours and
Madeline’s. Every morning when I unlock the door I’m in such a
hurry to look in and see that everything is all right and all here. It’s so
pretty and I love it so, that I’m afraid it will vanish some night like a
fairy palace.”
It was odd that the very next morning when Betty unlocked the
door, she should find that some marauder had been there before her.
She had locked her desk the night before, as she always did. But
during the night the lid had been forced back, the papers in the
pigeonholes tossed out on to the floor, the drawers opened and
emptied.
Her face was white and frightened as she rushed over to find
Babbie, who was staying in the little white house this time.
“The tea-room has been robbed!” she gasped. “Come over there,
quick.”
Babbie, who always breakfasted late, was pinning her collar, and
she gave a start that jabbed the pin straight into her thumb. “Ouch,
but that hurt!” she groaned. “What did they take?”
“I was so frightened I didn’t stop to see. I thought they might be
hiding in the loft.”
Babbie dropped a skirt over her head, and started down the
stairs, hooking it up as she ran.
“They wouldn’t do that. They’d want to escape in the dark,” she
called back encouragingly.
But at the door of the tea-shop she paused. “There is something
moving up there,” she whispered cautiously. “See! Over in that
corner by the curtain.”
Betty couldn’t see anything moving, but when Babbie started in a
hasty retreat toward the little white house she banged to the big door
and followed. Just then Bridget came waddling breathlessly up the
hill.
“Wat’s up now, Misses?” she called. “Why are yez afther shuttin’
of me out?”
Bridget’s fat figure was very reassuring. Simultaneously Betty
and Babbie ran toward it, gasping out the news.
“COME ALONG NOW”

“In the loft? Well, we’ll finish ’em thin.” Bridget seized a brass-
handled poker, the latest addition to the tea-shop’s stock of antiques.
Then she laid it down again, carefully removed her neat black
bonnet, and as carefully laid it on a table. “No use of spilin’ that in a
fight. Come along now wid yez,” she ordered.
Betty seized an umbrella that some one had opportunely left in a
corner, and Babbie chose as weapon a tall brass candlestick. Then
the procession started, Bridget waddling and wheezing in front,
Betty, still white with terror, following, and Babbie, beginning to smile
again at the absurdity of the search, bringing up the rear. But they
hunted conscientiously, exploring every hiding-place into which a
man could possibly squeeze himself and some that would have
cramped a self-respecting cat.
“They ain’t here at all,” announced Bridget at last, removing her
eye from a knot-hole in the wall into which she had been spying
laboriously, and standing upright with more puffings and pantings.
“It’s downstairs we go. Thim stalls are foine for burgulars, and
mebbe they’re in me kitchen this minute, ating up me angil-food that
’ud riz light as a feather. Oh me, oh me.”
“They aren’t here now. I’m sure they’re not,” protested Babbie.
“Think how absurd it would be for a burglar to hide in here, just
waiting around to be caught. I’m going to see what we’ve lost.”
Bridget persisted in completing her search, and Betty would not
desert her. But when the fat cook was satisfied and had sat down to
fan herself into a semblance of calmness that would make possible
the successful cooking of waffles for the “Why-Get-Up-to-Breakfast
Club,” Betty joined Babbie, and together they straightened out and
looked over the papers from the desk.
“There’s nothing gone. Of course they wouldn’t want grocer’s
bills, even if they were receipted,” Betty declared. “But I left six
dollars and thirty cents all rolled up in one of the top drawers. Emily
forgot it when she went to the bank. I suppose they’ve got that.”
“Drawer wide open, and one—five—yes, six dollars and thirty
cents all here,” Babbie reported. “That’s very queer. Burglars that
hunt as hard as this and then don’t take the money when they find it
are certainly particular. Well, did they like our old brasses, I wonder,
or our plated silver spoons?”
But the candlesticks—except the one Babbie had seized upon—
and the Flemish lamps were all in place. The gargoyles grinned
serenely from their accustomed niches. The silver drawer had not
been tampered with. In the kitchen the angel-food was just as
Bridget had left it.
“It’s a mystery,” declared Babbie at last, “a thrilling and
impenetrable mystery. When do burglars not burgle?”
“When they are frightened off,” answered Betty prosaically.
“But it wouldn’t have taken a second to dip out that money,”
Babbie objected. “It was all mussed up, so some one’s hand must
have been in there, since you left it in a roll——”
“Yes, in a tight little wad,” put in Betty.
“And that some one could have pulled back his hand full just as
quickly as empty,” Babbie went on. “I tell you it’s a horrible mystery.
I’m going to ask Robert to come over this minute and see about it.”
Meanwhile Emily, who had been doing the day’s marketing,
arrived; but neither she nor Mr. Thayer could solve the “thrilling,
impenetrable, horrible” mystery, though Mr. Thayer found “jimmy”
marks on the shed door, and that, as Betty said, proved beyond a
doubt that the burglars had been the real thing.
“Real, but very eccentric,” laughed Emily. “Let’s hope that all the
Tally-ho’s burglars will belong to the same accommodating tribe.”
CHAPTER XIX
THE AMAZING MR. SMITH AND OTHER
AMAZEMENTS

“Rachel Morrison? No, not yet, but she’s coming. Everybody’s


coming.”
“K. Kittredge is as comical as ever. Ask her about her prize
English pupil.”
“Do you know, you’re glad to see everybody these days. Why,
Jean Eastman rushed up to me, and I fell upon her neck. Digs and
freaks and snobs and all, they belong to 19— and the good old
days.”
“Do you feel that way too? I wondered if any one else had noticed
the horrid little changes. I suppose things will change, but I wish——”
“Nonsense! Look at this tea-shop. It’s a change all right, and for
my part I don’t see how we should live without it.”
“Oh, but this is different. This is 19—’s very own.”
“Where’s Betty Wales, anyway? She’s so busy you can’t get
within a mile of her.”
Thus 19—, over its ices in the Peter Pan Annex. The Tally-ho
Tea-Shop was 19—’s headquarters, official and unofficial. There they
breakfasted, lunched, tea-ed, and dined; there held informal “sings”
and rallies, and there on the last evening of the festal week they
were to eat their class supper. The tenth year class were to eat theirs
in the loft. The fifteeners had engaged the first floor of the Peter Pan
Annex, and the six graduates of the very oldest class were to lunch
up in the top floor, among the tree-tops. No wonder that Betty was
busy and had to be caught on the wing and forcibly detained by 19—
friends. Commencement guests fairly beset the Tally-ho at meal-
times. Between meals old girls and belated undergraduates thronged
the tables. Betty could hardly believe her eyes when she counted up
one day’s returns from the Peter Pan Annex. As for ploshkins, the
first order had sold out almost before it was unpacked, and every
class in college had wanted to adopt the ploshkin for its class animal.
But Betty explained that 19— had already secured it.
Madeline had had that happy thought, of course, and Kate
Denise, who was chairman of the supper committee, had capped it
by ordering miniature ploshkins for favors and a mammoth one for a
centerpiece. Then Madeline had written a ploshkin song which was
so much cleverer than “The Bay Where the Ploshkin Bides,” that the
Glee Club groaned with envy. There was also a 19— song called
“Tea-Shop,” and one called “The House of Peter Pan,” so that Betty’s
enterprises were much in the public eye, if she was not.
It was dreadfully hard to stick to work, when you knew that 19—
was having a “Stunt-doers’ Meet” under the apple-trees on the back
campus, or Dramatic Club’s Alumnæ tea, also with “stunts,” was on
in the Students’ Building. The only consolation lay in the fact that
your dearest friends calmly cut these surpassing attractions, to which
some of them had traveled thousands of miles, just to sit by the
cashier’s desk in the Tally-ho Tea-Shop, and talk to the cashier in her
intervals of comparative leisure, waiting patiently while she made
change, found tables for helpless or hurried customers, took “rush
orders” to the kitchen when the waitresses were all too busy, and in
general made things “go” in the steady, plodding, systematic fashion
that her gay little soul loathed. But she realized that she had made a
success of the Tally-ho just by keeping at it, and she was going
home next week with little Dorothy and “money in her pocket,” in
Will’s slangy phraseology, leaving Emily to take charge of the
improvements which Madeline and Mr. Morton had planned on a
scale of elegance that fairly took away Betty’s breath, and of the
remnants of business that would be left when the hungry Harding
girls had departed, and sleepy silence reigned on the deserted
campus.
Eugenia Ford came in one afternoon early in commencement
week, looking very meek and unhappy.
“I’m going home to-night. I was foolish to plan to stay over, but a
senior I know asked me to, and I thought of course she meant it. And
she only let me entertain her youngest brother part of one morning,
and made me give her my ticket to the senior play.”
“What a shame!” Betty sympathized.
“But I was to blame. I was a goose,” Eugenia repeated. “I ought
to have known that she only wanted to get something out of me. If I
rush up to people all of a sudden, when I’ve never noticed them
much before, I generally want to get something out of them. It’s
naturally the same with other girls.”
Betty laughed. “Better stick to the ones who are always nice to
you—your real friends,” she advised.
“But then you won’t get on,” objected Eugenia wisely. “They say
you’ve got to scheme a lot to be in things here. You’ve got to make
yourself known.”
“Why not just try to be worth knowing?” Betty suggested. “My
friend Rachel Morrison was as quiet and—and—unpushing as could
be, but she was so bright and nice and thoughtful for other people
and so reliable that everybody wanted her for a friend.”
Eugenia sighed. “I’m not bright or thoughtful for others. I—oh,
dear, this isn’t what I came to talk about, Miss Wales. I—I stopped to
say good-bye to Dorothy. I—she—we made up. I mean—we hadn’t
exactly quarreled, so we couldn’t exactly make up. But I felt so
ashamed. Being mean to little girls makes you feel so ashamed—
even if they don’t know about it. Miss Wales, I’ve heard about the
dormitory for poor girls—Morton Hall. When I went home in the
spring my father said that as far as he could see you’d taught me
about all the sensible things I’d learned this year. He asked me what
you’d like for a present. I couldn’t decide, but when I heard about the
dormitory I wrote and asked him to send you a check for extra
things, you know, for the furnishings, or to pay part of some girl’s
board. I thought perhaps you’d rather have that—from us—than
something for yourself.” She put three checks into Betty’s hand. “Two
of my best friends sent the others. It was what they had left from
their spring term allowances. Susanna would like hers to go for a
picture in the house parlor. Molly doesn’t care.”
Eugenia rushed through all this information so fast that Betty had
no chance to interrupt, and at the end she was speechless with
surprise. She glanced at the checks. The smallest was for a hundred
dollars. Together they would provide endless “extras” for Morton Hall,
or help dozens of poor girls to make both ends meet.
“Oh, Eugenia, you are a dear,” she cried impulsively. “And your
father is a dear too, and these other girls. But why not give it right to
the college yourselves?”
“Because you’ll think of something nicer than they would to do
with it. Anyway it’s a sort of a present to you—father’s part. You’re
just to say it’s from friends of yours. We don’t want our names
mentioned. You’re the one who put the idea into my head. We’re not
doing it for anything but to please you, and Susanna and Molly
because they liked the idea, and what was the use keeping over
their allowances?”
Betty was glad of this explanation. She had tried to choke back
an ugly little suspicion that this gift might be a part of Eugenia’s
campaign to “make herself known,” by having her father’s name
linked with Mr. Morton’s as a benefactor of Harding. Now she was
reassured on that point, and she thanked Eugenia again, trying to
make her feel how much the money would accomplish.
“I suppose that’s so,” Eugenia agreed, “and we shan’t any of us
miss it. Lots of the girls could give away more than they do, Miss
Wales, only they never think of it.”
“It’s the same way about helping the ones who are rather left out
to have some good times,” Betty put in eagerly. “It doesn’t take much
effort or time from your own fun, and it means such a lot to them.”
“Yes,” Eugenia agreed soberly. “I’m going to try to be more like
that next year. It’s horrid to be as snippy as most of our crowd are.
Some awfully nice girls are left out of things for one reason or
another. We should all have more fun, I guess, if we all had it,”
ended Eugenia rather obscurely. “Good-bye, Miss Wales, until next
fall.”
Betty was wondering busily whether she should be back next fall,
for mother had just written that father’s business was improving fast
and that he hoped to have the family together again soon, when the
supper committee appeared to inquire about the shape of the 19—
table and to consult the president about the seating arrangements.
Betty was deep in the problem of how to get all the speakers on one
side of the table and yet not separate them from their friends, when a
strange gentleman walked in and came straight up to Betty’s desk.
“Miss Wales?” he inquired in businesslike tones.
“I am Miss Wales.” Betty stood up behind the desk, and Kate
Denise and the rest withdrew to a window until the man should have
finished his business with Betty.
“My name is Smith,” he went on. “I represent Furbush, a Boston
antique shop. You’ve heard of it, I presume?”
Betty had not heard of Furbush’s.
“Well, that’s not vital,” Mr. Smith told her smilingly, “because we
buy on a cash basis, so it’s not a question of our credit. I should
have said that I’m up here buying old furniture. I heard you had a
rather good desk that you might like to sell, and some pieces of
brass.”
“Yes, we have those things, but we don’t care to sell any of
them,” Betty told him shortly. The idea of any one’s coming to buy
the Tally-ho’s most prized features, and in commencement week too,
when every minute was precious. Mr. Smith’s hand was on the desk,
but now he looked down as if he had but just discovered the fact.
“Oh, this is the desk I was told about, isn’t it?” he said, and came
around to Betty’s side to see it to better advantage. “It’s a good piece
—a very good piece. I’ll give you a good price for it, Miss Wales. Just
name your figure.”
“I couldn’t, for the desk belongs to the firm—the tea-shop firm,”
Betty answered. “And if we should even decide to sell,—though I
don’t think we shall—two friends of ours are ready to give us the full
value of the desk.”
“Now what would you consider the full value of the desk, Miss
Wales?” Mr. Smith asked, in a tone that was meant to be half
persuasive and half scornful of Miss Wales’s knowledge of antiques.
“I don’t know exactly, and it doesn’t matter at all, because we
don’t wish to sell the desk or anything else that we have.” Betty’s
tone was meant to be wholly anxious for the immediate departure of
the importunate Mr. Smith.
“I’ll give you four hundred dollars for that desk, Miss Wales.
That’s about five times what you paid for it, I guess, and twice what
your friends would give. Furbush’s can pay top prices for a thing they
like, because their customers are the top-price sort.”
Betty was inwardly amazed, both at the sum Mr. Smith offered
and at the accuracy of his guesses about the price Madeline had
paid and the advance Mrs. Bob had offered. But she reflected that if
Furbush’s, of which she had never heard, would pay four hundred
dollars for the desk to-day they probably would pay that or nearly
that later in the week. Babbie was off walking with Mr. Thayer, whom
she was keeping very much in the background because only Betty
and the other two B’s were to know of the engagement until class
supper night, when Babbie meant to run around the table with the
other engaged girls. And Madeline had not yet torn herself away
from her beloved studio apartment, where her latest diversion was
papering her study with “rejection slips” from over-fastidious editors.
The desk certainly could not be sold at any price without Madeline’s
consent. So in the face of Mr. Smith’s munificent offer, Betty
preserved a stony silence which finally evoked a low whistle from
that gentleman.
“All right,” he said, slipping his hand lovingly across the carved
panels and the inlaid fronts of the little drawers. “If you feel that way
about it, Furbush must do without. Now have you the same
objections to selling me a cup of tea?”
“Certainly you can have tea here,” Betty told him. “If you will sit
down at one of the tables you will be served directly.” Then she
turned her attention to Kate and the others, and forgot all about Mr.
Smith, who chose a retired nook in Flying Hoof’s stall, ordered tea
with three kinds of sandwiches, pulled a book out of his pocket, and
explained to the waitress that he liked to eat slowly and read, without
being disturbed.
The supper committee worked out its seating plan and departed,
highly indignant that Betty wouldn’t come up to the campus with
them to pay calls on the lesser stars of the senior play cast, who
were on exhibition in their make-ups.
“I’m lucky to get off to-night for the play,” Betty told them sternly,
and in the pause before dinner she tried to concentrate her mind on
preparing a menu for the next day. She needed to consult Bridget
about several items, and as the tea-room was quite empty and she
would only be gone a minute she slipped out without calling in Emily,
who was busy in the kitchen, to take her place at the desk. When
she came back she was startled to find her chair occupied by Mr.
Smith, who had opened several drawers and was poking the fan-
shaped panel, trying vainly to push it to one side. Betty stared at him
for a moment in amazement, then she called out loudly, “I thought
you had gone, Mr. Smith,” keeping meanwhile close to the kitchen
door which separated her from Bridget, Nora, and Emily, for she had
no idea what a man might do when you caught him robbing your
desk.
But Mr. Smith was not even disconcerted. “Oh, no, Miss Wales,”
he began easily. “Don’t you remember I haven’t paid for my grub?
I’m not the sort of man to go off without paying my bill. I’d finished,
and you weren’t here, so I was taking a last lingering look at your
lovely desk. Seems to me as if there might be a secret drawer
behind one of these panels.” He tapped the panels gently, one after
another, with his knuckles.
“If we ever decide to sell you the desk, Mr. Smith, you can
examine it as closely as you like,” Betty told him with dignity. “But
now I must ask you to leave it alone.”
“Oh, very well,” Mr. Smith answered absently, still fingering the
carved panel in the center.
As Betty watched him indignantly, a dreadful thought came into
her head. The three checks that Eugenia had given her were on the
desk. She had tucked them carelessly under the blotter, meaning to
take them out again as soon as Kate and the others had gone. Betty
did not stop to consider how useless they would be to Mr. Smith. She
only reflected that he was certainly dishonorable, and probably
dishonest, and that the checks were a sacred trust. Mr. Smith was
absorbed in the arrangements of the desk. Betty slipped silently
through the kitchen door and approached Bridget.
“I’m not sure, but I think there’s a burglar in there,” she
whispered. “He’s at the desk, and he won’t get away from it. I want
you to scare him into another part of the room, and then bar the door
until I’ve found out whether or not he’s stolen anything. Do you
understand?”
“Aisy,” returned Bridget calmly, wiping her hands on her apron,
and seizing a poker and a rolling-pin she marched boldly into the
tea-room.
“Scat!” she hissed into the ear of the astonished Mr. Smith, who
jumped back like a frightened rabbit when he saw the poker and the
rolling-pin brandished dangerously about his head. In a minute
Bridget had him prisoned in Flying Hoof’s stall, in front of which she
danced back and forth, waving her improvised weapons frantically.
“I’ve got him,” she called triumphantly to Betty. “An’ if he’s a
burgular fur shure, I’ll kape him safe while Miss Emily do be runnin’
for the perlice.”
It took Betty only an instant to put her hand under the blotter, and
there, just as she had left them, were the three checks.
“Oh, Bridget, he’s not a burglar,” she cried. “The money is here all
right. Let him out the door. I’m sorry, Mr. Smith,” she added with
dignity, “but you certainly acted like a thief, so you mustn’t blame me,
since I knew that there was a large amount of money in the desk, for
treating you like one.”
“Indade it’s a good whack yez desarve for troublin’ me lovely
young ladies,” declared Bridget, reluctantly moving to one side to let
her prisoner pass out.
Mr. Smith, scowling angrily, walked across to the desk that had
been the cause of all the trouble, and threw down the slip Nora had
given him and the change to pay it.
“It’s a pity if a gentleman can’t satisfy his idle curiosity about the
date of an antique desk without being taken for a sneak thief,” he
declaimed angrily, as he started off.
“It’s a pity when a gintlemin ain’t got enough bisniss of his own to
mind so it’ll kape his nose out of other people’s private propity,” cried
Bridget after him, and then she turned her attention to comforting
Betty, who had been dreadfully frightened by the episode.
“I almost wish the desk was sold,” she declared with a sob in her
voice. “It’s always making us trouble with its queer old secret
drawers and the people that try to steal out of it—and don’t.”
“It’s a foine desk that burgulars can’t burgle, I’m thinkin’,” Bridget
declared consolingly.
“But it attracts burglars,” Betty objected, “and being frightened is
almost as bad as being really robbed.”
Madeline, who came that evening, fairly gloated in the mysterious
robbery and the strange conduct of Mr. Smith. “It’s like living in a
detective story,” she declared. “Mr. Smith was hunting for something,
and so were the burglars,—something so valuable that they turned
up their noses at six good round dollars. Those old papers can’t be
valuable. Therefore it stands to reason that there must be something
else in there that we haven’t found—jewels, maybe, worth a king’s
ransom. As soon as I’ve embraced dear old 19—, I’ll have another
hunt.”
But embracing dear old 19— was a more absorbing process than
Madeline had counted it. Class supper night, the grand wind-up of
Harding commencement, arrived, and she had not given another
thought to the hidden treasure.

You might also like