100% found this document useful (3 votes)
50 views

Download Full Beginning Swift Games Development for iOS: Develop 2D and 3D games Using Apple's SceneKit and SpriteKit 2nd Edition James Goodwill PDF All Chapters

Develop

Uploaded by

beuckhajec3b
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
50 views

Download Full Beginning Swift Games Development for iOS: Develop 2D and 3D games Using Apple's SceneKit and SpriteKit 2nd Edition James Goodwill PDF All Chapters

Develop

Uploaded by

beuckhajec3b
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Download the full version of the textbook now at textbookfull.

com

Beginning Swift Games Development for iOS:


Develop 2D and 3D games Using Apple's
SceneKit and SpriteKit 2nd Edition James
Goodwill
https://textbookfull.com/product/beginning-swift-
games-development-for-ios-develop-2d-and-3d-games-
using-apples-scenekit-and-spritekit-2nd-edition-
james-goodwill/

Explore and download more textbook at https://textbookfull.com


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

Godot 4 Game Development Projects: Build five cross-


platform 2D and 3D games using one of the most powerful
open source game engines 2nd Edition --
https://textbookfull.com/product/godot-4-game-development-projects-
build-five-cross-platform-2d-and-3d-games-using-one-of-the-most-
powerful-open-source-game-engines-2nd-edition/
textbookfull.com

iOS Apprentice Eighth Edition Beginning iOS Development


with Swift and UIKit Raywenderlich Tutorial Team

https://textbookfull.com/product/ios-apprentice-eighth-edition-
beginning-ios-development-with-swift-and-uikit-raywenderlich-tutorial-
team/
textbookfull.com

Game Programming in C Creating 3D Games Creating 3D Games


Sanjay Madhav

https://textbookfull.com/product/game-programming-in-c-
creating-3d-games-creating-3d-games-sanjay-madhav/

textbookfull.com

Employability via Higher Education Sustainability as


Scholarship Alice Diver

https://textbookfull.com/product/employability-via-higher-education-
sustainability-as-scholarship-alice-diver/

textbookfull.com
Reasoning Web Semantic Interoperability on the Web 13th
International Summer School 2017 London UK July 7 11 2017
Tutorial Lectures 1st Edition Giovambattista Ianni
https://textbookfull.com/product/reasoning-web-semantic-
interoperability-on-the-web-13th-international-summer-
school-2017-london-uk-july-7-11-2017-tutorial-lectures-1st-edition-
giovambattista-ianni/
textbookfull.com

Implicit bias and philosophy. Volume 1, Metaphysics and


epistemology 1st Edition Brownstein

https://textbookfull.com/product/implicit-bias-and-philosophy-
volume-1-metaphysics-and-epistemology-1st-edition-brownstein/

textbookfull.com

Psychology, 14e Carole Wade

https://textbookfull.com/product/psychology-14e-carole-wade/

textbookfull.com

SASE For Dummies®, Versa Networks Special Edition Kumar


Mehta

https://textbookfull.com/product/sase-for-dummies-versa-networks-
special-edition-kumar-mehta/

textbookfull.com

Where The Party Rules The Rank And File Of China s


Communist State Daniel Koss

https://textbookfull.com/product/where-the-party-rules-the-rank-and-
file-of-china-s-communist-state-daniel-koss/

textbookfull.com
Industrial chemistry of oxides for emerging applications
First Edition Blanchart

https://textbookfull.com/product/industrial-chemistry-of-oxides-for-
emerging-applications-first-edition-blanchart/

textbookfull.com
Beginning
Swift Games
Development for iOS
Develop 2D and 3D games Using Apple’s
SceneKit and SpriteKit

Second Edition

James Goodwill
Wesley Matlock
Beginning Swift Games
Development for iOS
Develop 2D and 3D games Using Apple’s
SceneKit and SpriteKit

Second Edition

James Goodwill
Wesley Matlock
Beginning Swift Games Development for iOS: Develop 2D and 3D games Using Apple’s SceneKit and SpriteKit
James Goodwill Wesley Matlock
Highlands Ranch, Colorado, USA Kansas City, Missouri, USA
ISBN-13 (pbk): 978-1-4842-2309-3 ISBN-13 (electronic): 978-1-4842-2310-9
DOI 10.1007/978-1-4842-2310-9
Library of Congress Control Number: 2017942793
Copyright © 2017 by James Goodwill and Wesley Matlock
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. Exempted from this legal reservation are brief excerpts in connection with
reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed
on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or
parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s location, in its
current version, and permission for use must always be obtained from Springer. Permissions for use may be
obtained through RightsLink at the Copyright Clearance Center. Violations are liable to prosecution under
the respective Copyright Law.
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: Welmoed Spahr
Editorial Director: Todd Green
Acquisitions Editor: Aaron Black
Development Editor: James Markham
Technical Reviewer: Bruce Wade
Coordinating Editor: Jessica Vakili
Distributed to the book trade worldwide by Springer Science+Business Media New York,
233 Spring Street, 6th Floor, New York, NY 10013. 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 www.apress.com.
Apress and friends of ED books 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 Special
Bulk Sales–eBook Licensing web page at www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this text is available to readers
at www.apress.com/978-1-4842-2309-3. For detailed information about how to locate your book’s source
code, go to www.apress.com/source-code/.
Printed on acid-free paper
To Christy Goodwill,
my awesome wife, you have supported me all of these years.
I could not have done a fraction of what I have without you. I love you.

Wesley Matlock - for Amy


Contents at a Glance
About the Authors�������������������������������������������������������������������������������������������������� xiii
About the Technical Reviewer���������������������������������������������������������������������������������xv
Acknowledgments�������������������������������������������������������������������������������������������������xvii
Introduction������������������������������������������������������������������������������������������������������������xix


■Part I: Introduction to Spritekit���������������������������������������������������������� 1

■Chapter 1: Setting Up Your Game Scene and Adding Your First Sprites���������������� 3

■Chapter 2: SpriteKit Scenes and SKNode Positioning������������������������������������������ 19

■Chapter 3: Adding Physics and Collision Detection to Your Game���������������������� 33

■Chapter 4: Adding Scene Scrolling and Game Control����������������������������������������� 45

■Chapter 5: Adding Actions and Animations��������������������������������������������������������� 55

■Chapter 6: Adding Particle Effects to Your Game with Emitter Nodes����������������� 71

■Chapter 7: Adding Points and Sound������������������������������������������������������������������� 87

■Chapter 8: Transitioning Between Scenes��������������������������������������������������������� 103

■Chapter 9: SpriteKit Best Practices������������������������������������������������������������������� 115

v
vi Contents at a Glance


■Part II: Introduction to Scenekit����������������������������������������������������� 129

■Chapter 10: Creating Your First SceneKit Project���������������������������������������������� 131

■Chapter 11: Scenes and Nodes�������������������������������������������������������������������������� 143

■Chapter 12: Lighting, Camera, and Material Effects in SceneKit����������������������� 157

■Chapter 13: Render Loop, Physics, and Moving Around������������������������������������ 167

■Chapter 14: Collision Detection������������������������������������������������������������������������� 175

■Chapter 15: SceneKit Interaction with SpriteKit����������������������������������������������� 183

■Chapter 16: SceneKit Editor������������������������������������������������������������������������������ 191

Index��������������������������������������������������������������������������������������������������������������������� 203
Contents
About the Authors�������������������������������������������������������������������������������������������������� xiii
About the Technical Reviewer���������������������������������������������������������������������������������xv
Acknowledgments�������������������������������������������������������������������������������������������������xvii
Introduction������������������������������������������������������������������������������������������������������������xix


■Part I: Introduction to Spritekit���������������������������������������������������������� 1

■Chapter 1: Setting Up Your Game Scene and Adding Your First Sprites���������������� 3
What You Need to Know and Have����������������������������������������������������������������������������������� 3
Introducing SuperSpaceMan�������������������������������������������������������������������������������������������� 3
Creating a Swift SpriteKit Project������������������������������������������������������������������������������������� 4
Starting from Scratch������������������������������������������������������������������������������������������������������� 7
The GameViewController Class������������������������������������������������������������������������������������������������������������� 11
The GameScene Class�������������������������������������������������������������������������������������������������������������������������� 13

Adding a Background and Player Sprite������������������������������������������������������������������������� 14


Summary������������������������������������������������������������������������������������������������������������������������ 18

vii
viii Contents


■Chapter 2: SpriteKit Scenes and SKNode Positioning������������������������������������������ 19
What Is an SKScene?����������������������������������������������������������������������������������������������������� 19
The SKScene Rendering Loop���������������������������������������������������������������������������������������� 20
Building the Scene’s Node Tree�������������������������������������������������������������������������������������� 22
Rendering the Node Tree���������������������������������������������������������������������������������������������������������������������� 24
Searching the Node Tree���������������������������������������������������������������������������������������������������������������������� 26

Looking at SKSpriteNode Coordinates and Anchor Points���������������������������������������������� 27


Coordinates������������������������������������������������������������������������������������������������������������������������������������������ 28
Anchor Points��������������������������������������������������������������������������������������������������������������������������������������� 30

Summary������������������������������������������������������������������������������������������������������������������������ 32

■Chapter 3: Adding Physics and Collision Detection to Your Game���������������������� 33
What Is an SKPhysicsBody?������������������������������������������������������������������������������������������� 33
Adding Physics to Your Game World������������������������������������������������������������������������������� 34
Applying Forces to SKPhysicsBody�������������������������������������������������������������������������������� 35
Adding Collision Detection to Your SKNode�������������������������������������������������������������������� 37
Adding a Node to Collide Into��������������������������������������������������������������������������������������������������������������� 38
Adding Collision Detection�������������������������������������������������������������������������������������������������������������������� 38
Adding Bit Masks to Your SKPhysicsBody�������������������������������������������������������������������������������������������� 39
Removing the Orb When You Receive a Contact Message������������������������������������������������������������������� 41

Summary������������������������������������������������������������������������������������������������������������������������ 44

■Chapter 4: Adding Scene Scrolling and Game Control����������������������������������������� 45
Reorganizing the GameScene���������������������������������������������������������������������������������������� 45
Adding More Orbs to the Scene������������������������������������������������������������������������������������� 47
Scrolling the Scene�������������������������������������������������������������������������������������������������������� 50
Controlling Player Movement with the Accelerometer��������������������������������������������������� 52
Summary������������������������������������������������������������������������������������������������������������������������ 54
Contents ix


■Chapter 5: Adding Actions and Animations��������������������������������������������������������� 55
Refactoring the Orb Node Layout One Last Time������������������������������������������������������������ 55
Sprite Kit Actions������������������������������������������������������������������������������������������������������������ 58
Using Actions to Move Nodes in the Scene������������������������������������������������������������������������������������������ 59
Using SKActions to Animate Sprites����������������������������������������������������������������������������������������������������� 63

Adding Some Additional Bling to the GameScene���������������������������������������������������������� 65


Summary������������������������������������������������������������������������������������������������������������������������ 69

■Chapter 6: Adding Particle Effects to Your Game with Emitter Nodes����������������� 71
Using Particle Emitter Templates����������������������������������������������������������������������������������� 73
Creating a Particle Emitter��������������������������������������������������������������������������������������������� 73
Particle Emitter Properties��������������������������������������������������������������������������������������������� 76
The Particle Life-Cycle Properties�������������������������������������������������������������������������������������������������������� 78
The Lifetime Start and Range Properties���������������������������������������������������������������������������������������������� 79
The Particle Movement Properties������������������������������������������������������������������������������������������������������� 79

Adding an Exhaust Trail to the Player����������������������������������������������������������������������������� 82


Summary������������������������������������������������������������������������������������������������������������������������ 86

■Chapter 7: Adding Points and Sound������������������������������������������������������������������� 87
Introducing SKLabelNodes��������������������������������������������������������������������������������������������� 87
Changing the Horizontal Alignment of the Label Node������������������������������������������������������������������������� 89
Changing the Vertical Alignment of the Label Node����������������������������������������������������������������������������� 91

Adding Scoring to the Game������������������������������������������������������������������������������������������� 95


Adding an Impulse Counter to the Game������������������������������������������������������������������������ 97
Adding Simple Sounds to the Game����������������������������������������������������������������������������� 100
Summary���������������������������������������������������������������������������������������������������������������������� 101

■Chapter 8: Transitioning Between Scenes��������������������������������������������������������� 103
Pausing Scenes During a Transition����������������������������������������������������������������������������� 104
Detecting When a New Scene Is Presented����������������������������������������������������������������� 104
Adding a New Scene to SuperSpaceMan��������������������������������������������������������������������� 105
Ending the Game���������������������������������������������������������������������������������������������������������� 106
Winning the Game�������������������������������������������������������������������������������������������������������� 107
x Contents

Losing the Game���������������������������������������������������������������������������������������������������������� 108


Adding the Transition���������������������������������������������������������������������������������������������������� 109
Summary���������������������������������������������������������������������������������������������������������������������� 113

■Chapter 9: SpriteKit Best Practices������������������������������������������������������������������� 115
Creating Your Own Nodes with Subclassing���������������������������������������������������������������� 115
Reusing Textures���������������������������������������������������������������������������������������������������������� 120
Externalizing Your Game Data�������������������������������������������������������������������������������������� 123
Keeping Your Node Tree Pruned����������������������������������������������������������������������������������� 125
Summary���������������������������������������������������������������������������������������������������������������������� 127


■Part II: Introduction to Scenekit����������������������������������������������������� 129

■Chapter 10: Creating Your First SceneKit Project���������������������������������������������� 131
SceneKit Primer����������������������������������������������������������������������������������������������������������� 131
SceneKit Animation���������������������������������������������������������������������������������������������������������������������������� 132
What You Need to Know��������������������������������������������������������������������������������������������������������������������� 133

Creating the SceneKit Project�������������������������������������������������������������������������������������� 134


Wiring Up and Building a Scene����������������������������������������������������������������������������������� 136
Swiftystein3D������������������������������������������������������������������������������������������������������������������������������������� 136
Project Resources������������������������������������������������������������������������������������������������������������������������������� 138
Building the Scene������������������������������������������������������������������������������������������������������������������������������ 138

Summary���������������������������������������������������������������������������������������������������������������������� 142

■Chapter 11: Scenes and Nodes�������������������������������������������������������������������������� 143
Scene Graph����������������������������������������������������������������������������������������������������������������� 143
SceneKit’s Built-in Model Classes�������������������������������������������������������������������������������� 145
SCNGeometry Objects������������������������������������������������������������������������������������������������������������������������ 145

Adding Collectable Nodes�������������������������������������������������������������������������������������������� 146


Summary���������������������������������������������������������������������������������������������������������������������� 155

■Chapter 12: Lighting, Camera, and Material Effects in SceneKit����������������������� 157
SceneKit Camera Usage����������������������������������������������������������������������������������������������� 157
Lighting Up the Scene�������������������������������������������������������������������������������������������������� 159
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Contents xi

Materials���������������������������������������������������������������������������������������������������������������������� 161
Applying Materials to Your Obstacles��������������������������������������������������������������������������� 164
Summary���������������������������������������������������������������������������������������������������������������������� 166

■Chapter 13: Render Loop, Physics, and Moving Around������������������������������������ 167
What Is the Render Loop?�������������������������������������������������������������������������������������������� 167
GameView: Moving the Hero���������������������������������������������������������������������������������������� 168
Writing the Callback Delegate Function��������������������������������������������������������������������������������������������� 169
Moving the Camera���������������������������������������������������������������������������������������������������������������������������� 170

Introducing CoreMotion Framework����������������������������������������������������������������������������� 171


Summary���������������������������������������������������������������������������������������������������������������������� 173

■Chapter 14: Collision Detection������������������������������������������������������������������������� 175
Collision Detection�������������������������������������������������������������������������������������������������������� 175
Summary���������������������������������������������������������������������������������������������������������������������� 182

■Chapter 15: SceneKit Interaction with SpriteKit����������������������������������������������� 183
SpriteKit Integration����������������������������������������������������������������������������������������������������� 183
Hooking Up the Controller to the Overlay��������������������������������������������������������������������� 185
“Game Over” Screen���������������������������������������������������������������������������������������������������� 187
Summary���������������������������������������������������������������������������������������������������������������������� 189

■Chapter 16: SceneKit Editor������������������������������������������������������������������������������ 191
The SceneKit Scene����������������������������������������������������������������������������������������������������� 191
Creating the Scene������������������������������������������������������������������������������������������������������� 194
Adding the Floor��������������������������������������������������������������������������������������������������������������������������������� 194
Adding the Hero���������������������������������������������������������������������������������������������������������������������������������� 195
Adding in the Camera������������������������������������������������������������������������������������������������������������������������� 197
Adding in Nodes��������������������������������������������������������������������������������������������������������������������������������� 200
Summary���������������������������������������������������������������������������������������������������������������������� 202

Index��������������������������������������������������������������������������������������������������������������������� 203
About the Authors
James Goodwill is a ten-time published author of books about leading technologies such
as iOS, Swift, Objective C, Grails, Groovy, Java Servlets, JavaServer Pages (JSP), Tomcat,
and Struts. He is a senior enterprise iOS and Java consultant in the Denver metro area and
frequent speaker and article writer. You can find additional resources about Sprite Kit, Swift,
and James himself at his blog at www.jgoodwill.org. You can also follow James on Twitter at
https://twitter.com/jamesgoodwill.

Wesley Matlock is a professional independent iOS consultant in the Kansas City metro
area. He has more than 20 years of development experience in several different platforms.
He first started doing mobile development on the Compaq iPaq in the early 2000s. Today he
enjoys developing on the iOS platform and bringing new ideas to life.

xiii
About the Technical
Reviewer
Bruce Wade is a software engineer from British Columbia, Canada. He started software
development when he was 16 years old by coding his first website. He went on to study
Computer Information Systems ad DeVry Institute of Technology in Calgary, then to further
enhance his skills he studied Visual & Game Programming at The Art Institute Vancouver.
Over the years he has worked for large corporations as well as several start-ups. His
software experience has led him to utilize many different technologies including C/C++,
Python, Objective-C, Swift, Postgres, and JavaScript. In 2012 he started the company
Warply Designed to focus on mobile 2D/3D and OS X development. Aside from hacking out
new ideas, he enjoys spending time hiking with his Boxer Rasco, working out, and exploring
new adventures.

xv
Acknowledgments
This book could not have been written without the incredible folks at Apress. The idea of a
Swift iOS gaming book began with a conversation with Steve Anglin and came to life with a
great discussion about gaming and Apple with Michelle Lowman. Mark Powers and James
Markham kept the book on the rails and brought it safely into the station. Bruce Wade made
sure all of the technical statements made sense and the code compiled and ran successfully.
I thank you all.
I want to send out a special thanks to Wes Matlock for taking over the Scene Kit section
of the book when my father passed. I just did not have the time or energy to complete the
second section of the book, and Wes stepped in without hesitation.
I also want to thank Deborah Saez for the wonderful artwork in the book. I highly
recommend her. She is both very talented and a very hard worker. You can find her at
www.deborahsaez.com/. Look her up.
Finally and most importantly, I want to thank the three girls in my life: Christy (my wonderful
wife) and our daughters, Abby (who supplied a ton of inspiration) and Emma (who did a great
technical review of the book). You three are the most important people in my life.
—James Goodwill

xvii
Introduction

Which Version of Swift Is Covered in This book?


This book covers version 3 of Swift and iOS version 10. As new versions are released, we
will update the source for this book at both the Apress.com web site and James Goodwill’s
blog at www.jgoodwill.org.

What This Book Is


Game apps are one of the most popular categories in the Apple iTunes App Store. Well, the
introduction of the new Swift programming language will make game development even
more appealing and easier to existing and future iOS app developers. In response, James
Goodwill, Wesley Matlock, and Apress introduce you to this book, Beginning Swift Games
Development for iOS.
In this book, you’ll learn the fundamental elements of the new Swift language as applied
to game development for iOS in 2D and 3D worlds using both Sprite Kit and Scene Kit,
respectively.

What You Need to Know


This book assumes you have a basic understanding of how to create applications for the
iPhone using Xcode. You will also need a basic understanding of Apple’s new programming
language, Swift 3. We assume that you can download, install, and use the latest version of
Xcode to create an application and run it on the iPhone simulator.

xix
xx Introduction

What You Need to Have


In terms of hardware, you need an Intel-based Macintosh running Mountain Lion (OS X 10.8)
or later. Regarding software, you need Xcode 8.x since that is the current version to include
Swift 3. You can download Xcode from the App Store or Apple’s developer web site at
http://developer.apple.com.

What’s in This Book?


In Chapter 1, you’ll learn about what Sprite Kit is and how you create a new Sprite Kit
game using Xcode. You will then dive in and create the beginnings of a Sprite Kit game
starting from scratch. You will learn about SKNodes and their subclasses, and you’ll use an
SKSpriteNode to add both a background node and a player node.
In Chapter 2, we will step back a bit and give you a deeper look at Sprite Kit scenes,
including how scenes are built and why the order they are built in can change your game.
The chapter will close with a discussion of Sprite Kit coordinate systems and anchor points
as they relate to SKNodes.
In Chapter 3, you’ll work with Sprite Kit’s physics engine and collision detection. The chapter
will begin with a discussion of SKPhysicsBody—the class used to simulate collision detection.
You will then turn on gravity in the game world and see how that affects the nodes. After
that, you will add a touch responder to propel the playerNode up into space, and finally you
will learn how to handle node collisions.
In Chapter 4, you’ll start adding some real functionality to your game. You’ll begin by making
some small changes to the current GameScene. After that, you will add additional orb nodes
to collide into. You will then add scrolling to your scene, allowing you to make it look like
the player is flying through space collecting orbs. Finally, you will start using the phone’s
accelerometer to move the player along the x-axis.
In Chapter 5, you’ll refactor the orb node’s layout one last time with the goal of enhancing
playability. After that, you will learn how you can use SKActions to move an SKSpriteNode
back and forth across the scene and then make that same node rotate forever. The chapter
will close with a look at how you can add colorizing effects to an SKSpriteNode using a
colorize action.
In Chapter 6, you’ll see how to define particle emitters and how to leverage them in Sprite
Kit games. After that, you will learn how you can use them to add engine exhaust to the
playerNode whenever an impulse is applied to the physicsBody.
In Chapter 7, you’ll see how you can use SKLabelNodes to add text to your Sprite Kit games.
Specifically, you’ll see how you how to add a label that keeps up with the number of
impulses remaining for the spaceman to use, and then you’ll see how you can add scoring
to the game to keep up with the number of orbs the spaceman has collected.
In Chapter 8, you’ll learn how to implement scene transitions using Sprite Kit’s SKTransition
class. You will look at some of the different types of built-in transitions Sprite Kit makes
available to you. You will also see how you can control each scene during a transition. At the
end of the chapter, you will take your newfound knowledge and add a menu scene to your
SuperSpaceMan game.
Introduction xxi

In Chapter 9, you’ll learn some Sprite Kit best practices; specifically, you will see how you
can create your own subclasses of SKSpriteNode so that you can better reuse your nodes.
You will then move on to changing your game to load all the sprites into a single texture
atlas that you can reference when creating all future sprites. After that, you will move on to
externalizing some of your game data so that designers and testers can change the game
play. Finally, you will close out the chapter when you prune your node tree of all nodes that
have fallen off the bottom of the screen.
In Chapter 10, you’ll learn about what Scene Kit is and how to create a new Scene Kit game
using Xcode. You will then dive in and create the beginnings of a Scene Kit game starting
from scratch. You will learn to about SCNScene and SCNodes with a Scene Kit primer.
In Chapter 11, you’ll learn more about the scene graph and some of the basics of Scene
Kit. You will start to create your game by loading the spaceman from his Collada file. You
will also learn about the Scene Kit primitive geometries by adding these as objects for the
spaceman to avoid.
In Chapter 12, you’ll learn how Scene Kit uses lighting and the type of lighting that is
available to you in Scene Kit. You will also examine how materials are added onto the
SCNNode, as well as how the camera is used within the scene.
In Chapter 13, you’ll learn about the basics of animating the objects in your game. You will
see a couple of different ways to animate the nodes to give you more than one way to do
your animations. Once you have completed this chapter, all your objects will move within the
scene.
In Chapter 14, you’ll learn about collision detection within the scene. You will learn how to
move the spaceman around the scene. Once you have the spaceman moving, you will learn
how to detect when the spaceman runs into an obstacle.
In Chapter 15, you’ll learn how to use a Sprite Kit scene within the Scene Kit scene. The
chapter will show you how to create a screen to show you a timer that you will start when
the user starts the game. The chapter will also show you how to display a “game over”
screen and then restart the game.
In Chapter 16, you will learn the basics of the SceneKit Editor. This chapter will give you
a basic understanding of creating a scene and various nodes visually in the editor. No
coding will be done, but rather drag and dropping nodes and using the various editors to
manipulate the objects.
Part I
Introduction to Spritekit
Swift and Sprite Kit
In this part of this book, we will cover the basics of Sprite Kit including how you render
and animate sprites, add physics and collision detection, and control your game play
with the accelerometer. You will also look at how you add particle emitters to enhance
the appearance of your game. We will cover everything you need to know to create
your own Sprite Kit game.
Chapter 1
Setting Up Your Game Scene
and Adding Your First Sprites
SpriteKit is Apple’s exciting 2D game framework that was first released in September 2013 with
iOS 7. It is an animation and graphics rendering framework that gives you the power to easily
animate textured images, play video, render text, and add particle effects. It also includes an
integrated physics library. SpriteKit is the first-ever game engine formally built into the iOS SDK.
In this chapter you will learn what SpriteKit is and how to create a new SpriteKit game using
Xcode. You will then move on and create the beginnings of a SpriteKit game starting from
scratch. You’ll learn about SKNodes and their subclasses and you’ll use an SKSpriteNode to
add both a background node and a player node to your game.

What You Need to Know and Have


This section of this book assumes you have a basic understanding of how to build iPhone
applications using Xcode and the Xcode Simulator. It also assumes you have a basic
knowledge of the iOS/Mac programming language Swift. If you are not familiar with Swift,
there is a brief introduction in the appendix at the back of this book.
This book doesn’t cover how to program. It focuses only on SpriteKit game programming.
To complete all the examples in the book, you will need to have an Intel-based Macintosh
running OS X 10.11 (El Capitan) or newer. You will also need Xcode 8+ installed. You can find
both of these in the Apple App Store.

Introducing SuperSpaceMan
We feel the best way to learn anything is to do it. Therefore, in this book you are going to
dive right in and create your own game. You will start off with the basic code for a 2D game,
and you will add new features to the game as we introduce new topics with each chapter.
At the end of the book, you will have a complete game.
© James Goodwill and Wesley Matlock 2017 3
J. Goodwill and W. Matlock, Beginning Swift Games Development for iOS,
DOI 10.1007/978-1-4842-2310-9_1
4 CHAPTER 1: Setting Up Your Game Scene and Adding Your First Sprites

The game you are going to create is inspired by Sega’s popular Sonic Jump Fever (https://
itunes.apple.com/us/app/sonic-jump-fever/id794528112?mt=8). It is a vertical scroller that
accelerates the main character through obstacles and collectables, increasing your score as
you collect rings.
This game is similar in that it is a vertical scroller, but your main character is going to be a
spaceman who hurtles through space collecting power orbs while trying to avoid black holes
that will destroy him.

Creating a Swift SpriteKit Project


Before you can get started, you will need to create a Swift SpriteKit project. Open Xcode and
complete the following steps:

1. Click File ➤ New ➤ Project.


2. Select iOS.
3. Select the Game icon from the Application group. The choose
template dialog should look like Figure 1-1.

Figure 1-1. The choose template dialog


Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
CHAPTER 1: Setting Up Your Game Scene and Adding Your First Sprites 5

4. To move on, click the Next button.


5. Enter SuperSpaceMan for Product Name, Apress for Organization
Name, and com.apress for Organization Identifier.
6. Make sure that Swift is the selected language, SpriteKit is the
selected game technology, and iPhone is the selected device.
7. Before you click Next, look at Figure 1-2. If everything looks like that,
click Next and select a good place to store your project files. Click
Create.

Figure 1-2. The choose project options dialog

Note You will notice you are creating an iPhone-only game. That’s only because the game you are
creating lends itself better to the iPhone. Everything we cover in this book translates to the iPad just
as well.
6 CHAPTER 1: Setting Up Your Game Scene and Adding Your First Sprites

You now have a working SpriteKit project. Go ahead and click the Play button to see what
you have created. If everything went OK, you will see your new app running in the simulator.

Note The Xcode simulator may take a while to start on some slower machines. Simulating
SpriteKit apps can be very taxing on your processors.

It doesn’t do a whole lot yet, but there is more to it than displaying “Hello, World!” Tap
the simulator screen a few times. You will see rotating boxes displayed wherever you tap.
Depending on where you tapped, you should see something similar to Figure 1-3.

Figure 1-3. The SpriteKit sample application


CHAPTER 1: Setting Up Your Game Scene and Adding Your First Sprites 7

Starting from Scratch


Although the standard SpriteKit template works great, you are going to be starting from
scratch. Starting from nothing will allow you to see all the working parts in a SpriteKit game
and will give you a much better understanding of what you are creating.
The first thing you need to do is make sure your game runs only in portrait mode. To do that,
follow these steps:
1. Select the SuperSpaceMan project in the Project Explorer.
2. Then select SuperSpaceMan from Targets.
3. Deselect Landscape Left and Landscape Right.

At this point, your target settings should look like Figure 1-4.

Figure 1-4. The SuperSpaceMan target settings


8 CHAPTER 1: Setting Up Your Game Scene and Adding Your First Sprites

The next thing you need to do is delete the GameScene.sks and Actions.sks files. You will not
be using the level editor in this book. You can find these files in the SuperSpaceMan group,
as shown in Figure 1-5.

Figure 1-5. Delete the SKS files

After you delete these files, open GameScene.swift and replace its contents with the class in
Listing 1-1.

Listing 1-1. GameScene.swift: The SuperSpaceMan Main GameScene

import SpriteKit

class GameScene: SKScene {

    required init?(coder aDecoder: NSCoder) {

        super.init(coder: aDecoder)
    }

    override init(size: CGSize) {

        super.init(size: size)

        backgroundColor = SKColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0)


    }
}
CHAPTER 1: Setting Up Your Game Scene and Adding Your First Sprites 9

There is one more change you need to make before examining your baseline project. Open
GameViewController.swift and replace its contents with the Listing 1-2 version of the same
class.

Listing 1-2. GameViewController.swift: The SuperSpaceMan Main UIViewController

import SpriteKit

class GameViewController: UIViewController {

    var scene: GameScene!

    override var prefersStatusBarHidden: Bool {


        return true
    }

    override func viewDidLoad() {

        super.viewDidLoad()

        // 1. Configure the main view


        let skView = view as! SKView
        skView.showsFPS = true

        // 2. Create and configure our game scene


        scene = GameScene(size: skView.bounds.size)
        scene.scaleMode = .aspectFill

        // 3. Show the scene.


        skView.presentScene(scene)
    }
}

Save all your changes and click the Play button once more. Wow, um, that was not very
exciting. If you made all the changes, you should now be staring at a totally black screen
with only the current frame rate displayed. This was the intent. You truly are starting from
nothing.
Let’s take a moment and examine each component of your new game. First, open Main.
storyboard. Everything here should look pretty normal. You should see a single storyboard
with a single UIViewController. Expand Game View Controller Scene in the Storyboard
Explorer and select Game View Controller, as shown in Figure 1-6.
Random documents with unrelated
content Scribd suggests to you:
“Hm!” Tompkins frowned. “Sagebrush, that mesa up ahead would
make a fine place for a chicken-ranch, wouldn’t it?”
“Hell of a fine place,” affirmed the desert rat, squinting at the long
saddleback. “Danged fine place, Perfesser! Every wildcat and coyote
in the Chuckwallas would be pointin’ that way, inside of a week. If a
gent was feelin’ real philanthropic and wantin’ to help out the pore
desert critters, I’d say start him a chicken-and-egg factory right up
yonder. Yessir. That’s like Haywire Johnson done, time he was livin’
down to Meteorite. He started him a egg-ranch—done it to get
ahead of some other folks and kep’ it real quiet. Got all his chickens
clear from Phoenix and Yuma, danged near a hull carload of ’em,
and set up incubators and all that truck. Then he begun to figger on
how rich he’d be. Every oncet in a while he’d go out to look for eggs,
but dad blame if he got any. He fed them chickens on everything
from ground-up lizards to eggplant, and nary a egg come along.
Finally he got desp’rit and called in help—and durned if all them
birds wasn’t roosters! Yessir, not a female chicken in the lot. That’s
how come Haywire went broke and had to come over yere to work
for Hassayamp.”

Tompkins grinned despite himself. Then he sobered.


“Look here, Sagebrush. Remember that young woman at the
hotel? They’ve framed up a deal on her. They’re trying to sell her a
chicken-ranch on this mesa.”
“Sounds like them city fellers. Dad blame, they’d rob a dyin’ man!
Serves the female right, too, for havin’ that much money. Females
aint got no right to have money. Oncet when I was married and livin’
down to Umatilla, my ol’ woman got ten dollars from one of her
relations and went to Phoenix, and durned if she didn’t spend it all in
three days. When I trounced her for it, she up and run off with a
Mormon from Yuma, and that’s the last of her. Twenty years ago that
was, and I been happy ever since, and ain’t looked twice at no
females.”
“That’s a novel argument, certainly,” said Tompkins. “But I’m
going to try and keep Miss Gilman from getting robbed. Are you with
me?”
Sagebrush rubbed his whiskers, squinted at the sand,
expectorated over an unwary Chuckwalla lizard, and then responded
without enthusiasm.
“Nope! Quicker that there female gits skun and gits out o’ this
country, better off I’ll be. I don’t hanker after no females spoilin’ the
scenery. Besides which, I aint pinin’ to start no argument with
Sidewinder Crowfoot and his crowd, not without they force me into
it. Leave the other feller alone, I says, so long’s he don’t crowd ye
none.”
“All right, then,” said Tompkins briskly, and turned to the car.
“Let’s get moving.”

They drove on in renewed silence. Tompkins had a new angle on


his companion, and was not sure that he liked it; at all events, he
perceived that Sagebrush knew his own mind and was not to be
depended upon as an assistant under the present completion of
things. The desert rat had a certain peculiar philosophy of his own,
like all old prospectors, and arguments against it would be as
useless as the teeth of a coyote against the shell of a tortoise. So
Tompkins held his peace.
The flat desert gave way to hills and depressions as they drew
closer to the range, and by the action of the engine Tompkins knew
that they had been on a steady climb. Also, he began to sight
scattered piñon trees, indicating a higher altitude, and was conscious
that they were following an ancient road. Presently the car was
climbing along a well defined valley, which Sagebrush called Mint
Cañon.
“Ol’ stamp-mill ahead of us,” he announced. “Fellers used to bring
quartz down to it from all around, in the ol’ days. Got to leave the
car there. Job Carter put up that there mill; four-stamp crusher, she
was—dad blame, how Job did like his licker! Used to make mint
juleps in a bucket. That’s how come he growed mint. Job, he used to
whiff the mint and then throw down the licker while he held his
breath. One night he wakes up with a pain in his stummick and
mixes him a julep in the dark, and got him the cyanide bottle by
mistake, and he’s buried somewhere back o’ the mill right now.
That’s what comes o’ not stoppin’ to appreciate your licker as it goes
down.”
They rounded a low hill and halted by the remains of the stamp-
mill—a structure of weather-beaten boards, open in front, with the
remains of a shed adjoining. The machinery was rusted and strewn
about the place haphazard, and the whole place was the epitome of
desolation. To one side was a board floor—the only relic of what had
once been a roadside saloon, adjoining the mill.
Sagebrush pointed out that by leaving the car here in shelter of
the shed, they could then shoulder packs and cover the last three
miles to Pinecate Cañon on foot. The Professor took one look at the
duffle in the rear of the car, and threw in the gears.
“Not by a blamed sight!” he said cheerfully. “Looks like
Hassayamp’s car has gone ahead, so we’ll do likewise. Did I mention
that Hassayamp is bringing Miss Gilman out today to look over the
cañon for a chicken-ranch site?”
“Dad blame it!” groaned Sagebrush. “Then I’m goin’ to take my
pick and go look over the north end o’ the mesa. You can pester
around that female if ye like, Perfesser, but not me. Send up a
smoke when they’re gone and I’ll come in.”
“Agreed,” and Tompkins laughed as he sent the car ahead in the
faint tracks left by the other flivver.
CHAPTER V
Noon was passed and over. Tompkins, ensconced in a niche of the
cañon, was delightedly observing the scene before him. Sagebrush
was gone. The flivver was laid up out of sight a half-mile away in a
thicket of cactus and piñon.
It was peaceful here in the cañon, and hot. Tompkins lay shaded
by an overhanging rock which concealed him and enjoyed himself
while he waited. He was a third of the way up the cañon, which
wound upward for another mile before opening on the mesa. Here it
was fairly wide, and the sun had excellent chances to radiate from
the boulders, and the spring life of the place was warmed into
activity. Patches of cacti and jack-pine abounded. No water was in
sight, but Tompkins had a water-bag within reach.
He lay perfectly quiet, watching a trade-rat whose nest lay in a
cranny of the rocks just to one side, and a young coyote which was
vainly endeavoring to investigate the rat and nest. It was obvious
that this particular rat had migrated from the desert below, for while
his nest was composed of pebbles and sticks and all manner of
queer objects, it was protected after the peculiar fashion of his
desert brethren. Two runways entered the nest, itself nearly out of
sight under the rocks; and about these runways, laid with
mathematical precision, were hundreds of terrible opuntia joints.
To Tompkins, as to every other naturalist, it was an unsolved
mystery how the pack-rat, with delicate and unprotected paws, could
handle these joints of cactus. No other living creature can face the
cholla cactus, whose spines, as the Indians declare, jump at one,
inflicting acute agony; even the rattler avoids it gingerly. Here for a
space of ten feet around the nest were heaped the matted cholla
joints, while the pack-rat who owned the establishment sat out in full
sight and insulted the hovering coyote with angry taunts.
That the coyote was young and hungry was obvious, or he would
not have attempted to molest so well-entrenched a rat. Oblivious to
the presence of Tompkins, who sat perfectly motionless, he charged
again and again on those defenses. Each time his courage failed at
the last moment and he would draw off, snarling and snapping in
futile rage, before his nose touched the cholla.
In a cool niche between two rocks, in sight of Tompkins above but
concealed from the furious coyote, lay a fifteen-inch sidewinder,
safely sheltered from the deadly rays of the sun, his brown-and-gray
length practically invisible against the rocks. He lay stretched out,
head lifted ready to strike, a venomous and malignant thing beyond
all words with his horned features and green jewels of eyes. The
coyote, unconscious of this lurking death, continued backward and
forward, now rushing and now sending a flurry of sand flying in his
anger. One such flurry had aroused the sidewinder, and Tompkins
waited for the inevitable, since the coyote was drawing closer and
closer to the unseen death.
Now it came, with such rapidity that the eye could scarcely follow.
Pawing the sand, the coyote came sidewise toward the niche of the
sidewinder, then went forward in another rush, stopped short,
snarled, and took courage again. His leap brought him past the
niche; and the sidewinder, after the fashion of his kind, struck
without warning or coiling. There is nothing swifter than the strike of
a sidewinder—but the coyote saw the lurking death just in time. A
frantic yap of fear broke from his jaws. He gave a desperate twist
sidewise in midleap—a doubling-up of his body that evaded the
reptile’s blow—and in mad panic came down and leaped again,
blindly. He landed squarely in the matted cholla.
Agonized howls rent the air, and sticks and bones and odd objects
from the pack-rat’s nest were hurled about; the coyote became a
whirlwind of furry agony from which proceeded howl upon howl of
anguish. Then, tail between legs, wailing to high heaven with every
leap, the wretched coyote went down the cañon like a streak and
was gone.
Tompkins caught up the stone under his hand and hurled it, then
rose. Crushed, the sidewinder lay quivering. A glittering object had
caught the eye of Tompkins, and now he raked it forth from the
cholla with a long stick. It was one of the mass of objects which had
formed the rat’s nest, flung about by the agonized flurry of the
coyote. When he had it within reach, Tompkins picked it up and
stood staring at it, incredulity and horror mingling in his eyes. It was
a small tarnished cigarette case of silver, and upon it he made out
the initials “A. R.”
“The case I gave Alec for Christmas two years ago!”
The words died on his lips. It was the property of his vanished
brother Alec Ramsay. Holding the case in his hand, he stared over
the desolate, empty cañon until the heat of the sun roused him. He
stooped, donned his pith helmet, and then looked again at the metal
case. Mechanically he pressed the spring, which refused to work.
Taking out his knife, Tompkins pried the case open—and beneath the
spring-holder discovered a folded paper, on which was scrawled in
pencil the writing of his brother.
His blurred eyes cleared. At the top was written:
Send this to Pat Ramsay, Glendale Apts. Denver.
And below, scrawled more sharply, but ending with an uncertain
dash:
Dear Pat: Forgot to mail this. Too late. They got me. Shot through lungs. 3
men in party. Bad gang here. All located Hourglass Cañon, N. E. of here. Box
cañon. Cholos and whites. Sidewinder—
That was all. Lips compressed, Tompkins read and reread this
fateful message, which now he knew to be a message from the
dead. Then, in that cold certainty, he opened the folded paper and
found it to be a deed, made out by Mesquite Harrison to Alec
Ramsay.
“By glory—the deed to Alec’s mining property!” he ejaculated, as
he conned the writing therein. Then, when he had finished reading,
he folded up the deed, replaced it in the cigarette case, slipped the
case into his pocket, and stood staring up the winding reaches of the
green cañon.
That property was located in this very cañon. Stunned as he was
by surprise heaped on surprise, he realized this only too clearly. His
brother was dead. The property in question had been bought from
Sidewinder Crowfoot for whom Mesquite Harrison had acted as a
blind. It lay somewhere up there toward the mesa—marked by that
split pink granite boulder, perfectly described in the deed as to
bounds and extent. It was this identical cañon for which he had
come searching so blindly. Had he gone on around the next bend, he
would have found the boulder with its piñon trees.
Tompkins sank down and took his head between his hands,
striving hard for sanity. His first impulses were not sane at all; they
were murderous. His brain was seething in tumult. He was not red-
headed for nothing.
By slow degrees his thoughts settled down into grim coherence.
Now he knew what he had long ago presumed to be the case—that
his brother was dead. But here in his pocket was evidence as to who
was responsible. There was no direct evidence against Sidewinder
Crowfoot, but Tompkins brushed this impatiently aside; he was
perfectly convinced that Crowfoot was the man behind everything
going on here.
“At the same time, I’ve got to be sane—got to be!” he thought
desperately, fighting for self-control. “I can’t go off half-cocked.
They’ve got brains. They’ll get me if I let out a peep. Nothing but my
own brains will save me now, and if I don’t go slow, I’m a goner
sure! This changes my whole program. Now I know everything—and
it’s up to me to get busy. First thing to do is to get back to town and
get this deed recorded—send it in by registered mail. The stage goes
out in the morning, so any time will do for that. Chuckwalla City is
the county seat; might run over there in the flivver, only I’d better
see Sidewinder Crowfoot, get my money, and sever connections.
And I’ll want a rifle, before I go up against that crowd in Hourglass
Cañon, wherever it is. Then—”
He was abruptly startled from his reflections by an eager hail, and
looked up to see Miss Gilman approaching, with Hassayamp trailing
behind her. He had forgotten the girl, and now an exclamation of
dismay broke from him. Then he rose, donning glasses and helmet
again, and nervously lighted up his pipe.
“We didn’t see you till we were almost on top of you,” exclaimed
Miss Gilman.
“Were you asleep? What makes your face look so white?”
“A touch o’ sun, madam. No, I was not asleep. I was watching the
peregrinations of yonder pack-rat. Not so fast, Mr. Foster—there is a
large crotalus cerastes just by your left foot.”
“A which?” demanded Hassayamp, by no means pleased to see
the professor.
“I believe you would term the reptile a sidewinder—”
“Oh, my gosh!” Hassayamp saw the dead snake and did an
acrobatic stunt that removed him some distance away, while a
revolver came out in his hand.
“Don’t shoot!” said Tompkins. “He’s dead. I killed him.”
“Why in hell didn’t you say so first?” snapped Hassayamp angrily.
“What you doin’ up this-a-way? Thought you was headin’ into the
sink-holes?”
“I changed my mind,” said Tompkins. He showed Miss Gilman the
pack-rat’s nest. “That’s worth seeing. I have a particular reason for
asking you to remember it. But may I inquire whither you two are
heading?”
“Up the cañon to look at a chicken-ranch site,” said the girl,
glancing from him to the nest and back again. “Will you come along?
Or don’t you feel well? Really, you looked almost ghastly at first, Mr.
Tompkins!”
“Reckon the climb would be too blamed hard on the Puffesser,
ma’am,” struck in Hassayamp, who did not desire company. “And
there aint no bugs up there.”
“All the more honor in discovering some, sir! I accept your
invitation, madam, and shall accompany you a little way.”
“We’ve brought lunch along, if you’ll join us,” invited Miss Gilman,
starting off again with Tompkins at her side. He glanced around and
saw that Hassayamp had paused to wipe a dripping brow and bite
off a fresh chew, and was momentarily out of earshot. Swiftly, he
took the cigarette case from his pocket and passed it to the girl.
“Open this and read it—quick, now! I found it in that rat’s nest.
When I tell you my real name is Pat Ramsay, you’ll be able to guess
why I came here—and whether my warning was well founded. Read
the deed carefully, then see whether the place you’re going to buy
corresponds with it. Quickly! I’ll hold this rascal engaged. Read and
give it back to me. I must get back to town at once.”

With this rapid utterance, he turned abruptly from the girl and
walked back to Hassayamp, halting the latter’s advance with
upraised hand.
“Mr. Foster!” he said solemnly. “May I inquire, sir—ah, that is a
very interesting creature on your collar, very interesting indeed!”
Hassayamp screwed his head to look at himself, but could see
nothing.
“What is it?” he demanded nervously. “A beautiful little creature,
peculiar to our deserts,” said Tompkins in bland accents.
“Undoubtedly it has sought refuge from the sun under your shirt-
collar. You know, of course, that the solpugid is really an insect,
having tracheal tubes instead of the spider’s book lungs—”
“A spider!” exclaimed Hassayamp. “Git it off’m me, Puffesser,
quick!”
“Not a spider at all, my dear sir, and quite harmless, I assure you,
despite local superstition. Ah, there it goes about your collar—no
wonder the dear little creatures are called wind-scorpions or
vinegaroons—”
“A matavenado—wow! My gosh, git him off’m me!” Hassayamp let
out a yell and began to claw at himself. “I’m a dead man—git him
off’m me—”
Tompkins seized him and brushed vigorously at his back.
“There—he’s gone. Pay no more attention to the matter, I implore
you. I was about to ask whether you ever indulge in spiritous
liquors, Mr. Foster? In such case, I have in my pocket a small vial of
medicinal whisky. I understand that it is the custom in the desert to
offer a drink—”
Hassayamp, who like many another man with slight experience of
the harmless but frightful-looking vinegaroons believed them to be
deadly creatures, was pale with emotion. And with more than
emotion, too.
“If you got a drink, Puffesser,” he implored, “for gosh sake give it
here! I swallered my plug.”
Tompkins produced a small pocket flask and began to unscrew it.
Hassayamp became yet more pale and agitated.
“Oh, gosh!” he groaned. “I’ll never eat no more tobacker—”
He reached out and took the flask. He sniffed it, and into his
melancholic eyes came a glow of warmth and happiness. Tompkins
beamed upon him, as he lifted the flask.
“I forgot to mention, Mr. Foster, that you must use your mustache
as a strainer, because in that whisky I am preserving a very fine
specimen of rock scorpion which I recently discovered, and I should
be very sorry to have it lost—”
Hassayamp jerked the flask from his lips. He looked at the
Professor with slowly distending eyes, then thrust the flask at him;
and, with one agonized groan, retired among the near-by boulders.
Tompkins turned and rejoined Miss Gilman.
“Hassayamp will rejoin you shortly,” he said. “He unfortunately
swallowed his chew of tobacco—an accident which will unnerve the
strongest man, I assure you—” The girl looked at him with strained
and anxious eyes.
“But this—this paper! Do you mean to tell me that this man Alec
Ramsay was your brother?”
Tompkins nodded quietly. “Yes, Miss Gilman. I came here to trace
him—and by a stroke of sheer luck I found this cigarette case. You
have read that deed? Then I advise you to go on up the cañon and
see if the description fits. I haven’t been up there. Be very careful to
say nothing to Hassayamp about this. I’ll see you tonight, if I may,
and we’ll talk over what is to be done. Now I must get off—you’d
better keep a sharp lookout for rattlers among these rocks. Don’t
wait for Hassayamp; he’ll be along as soon as he’s able. Hasta la
vista!”
She made no response, but stood gazing after him thoughtfully as
he turned and departed.
CHAPTER VI
As Tompkins climbed down the rock-strewn cañon toward the
thorny growth which hid the flivver from sight, he came to a decision
upon his course of action, forcing himself to determine upon a
caution which was distasteful and yet necessary.
“Hasta mañana!” he resolved. “Until tomorrow, at least, I must
remain Percival and so forth Tompkins—and then I’ll become Pat
Ramsay once more, and get into action. The damned murderers! I
wonder how many men have gone the way of poor Alec? I wonder
how many people have been decoyed into this spiderweb to lose
everything they had? Alec must have gone investigating, must have
discovered the headquarters of this gang—and so they finished him.
He’s probably lying somewhere up that cañon now. Well, time
enough to look him up; just now I’ve got to watch my step mighty
close.”
He was now assailed by the problem of locating Sagebrush, since
he could not well run off with the car and leave his companion to
rusticate in the desert solitudes. As he came in sight of the patch of
piñon and cactus which enshrined the flivver, he caught no sign of
the desert rat. He knew that he could recall Sagebrush with a
smoke, but this he did not desire to do unless necessary.
When he drew near the clump, he perceived Hassayamp’s flivver
on the other side, with strips of canvas flung over the tires to protect
them. An unusual object beneath this car attracted his attention, and
upon closer approach he discovered it to be no other than
Sagebrush. He gave a hail, and the old desert rat crawled out into
the sunlight.
An exclamation broke from Tompkins, and he hurried forward.
The left arm of Sagebrush was out of its shirt-sleeve and roughly
bandaged, and the bandage was dark with blood.
“What happened?” he demanded. “How’d you hurt yourself, old-
timer?”. Sagebrush clawed at his whiskers and flung the inquirer a
pained look.
“You got it plumb wrong, Perfesser,” he observed. “I aint been
meanderin’ around these parts for fifteen year or more ’thout leamin’
how not to hurt myself. I aint no pilgrim, by gosh!”
“My humble apologies,” said Tompkins dryly. “May I ask, then,
who hurt you?” Sagebrush grinned.
“Another of these yere smart gents who think that ’cause a man’s
a prospector and don’t wear galluses, he’s a babe in arms. I aint
right certain as to this feller’s name, but when I was over to Mohave
six months ago, I seen a picture of him in the sheriff’s office. Name
was Joe Mendoza, or some such cholo name.”
The speaker enjoyed hugely the bewilderment of Tompkins.
“You don’t mean you had a scrap, Sagebrush?”
“Nope.” Sagebrush expectorated, wiped his lips and grinned. “I
was peckin’ away at a ledge in a cañon a couple mile east of yere,
when durned if that feller Mesquite Harrison didn’t come ridin’ down
the cañon on a hoss! Yessir! Right on top o’ me, ’fore I seen him,
too. He started throwin’ lead, and I covered up, and ’fore I could git
into action, the coyote was gone. Then along come another feller
that I hadn’t seen, this yere cholo, and durned if he didn’t pick on
me too. But I was ready for him, you betcha! I gives him jest one
crack from ol’ Betsy,”—here Sagebrush patted his waistband
significantly,—“and he flops. I walks over to him and seen he looked
like this cholo Mendoza, and then I come back yere and set down to
rest a spell.”
“Killed him?” asked Tompkins curtly.
“Hope so. He was some dead when I left him, anyhow, but you
never can tell ’bout them marihuana-eaters. I knowed a cholo over
to Mormon Wells, oncet, that et marihuana and smoked it likewise.
Fin’ly one night he got plumb filled up on it, and jumped into the
corral and begun to slash the hosses with his knife. Sheriff and two
other fellers sat on the bars and pumped lead into him for as much
as five minutes, but he didn’t quit till he’d slashed every hoss there;
then he quit. Sheriff allowed he’d been dead with the first shot, but
the marihuana had kep’ him goin’, same’s a rattler keeps a-twitchin’
till sundown after he’s dead. That there hop is powerful stuff,
Perfesser.”

Tompkins stood staring at the desert rat for a moment. Then:


“The whole gang will be after you now, wont they?”
Sagebrush gave him a queer look. “How come you know so
durned much, Perfesser?”
“That’s what I’m here to know,” snapped Tompkins suddenly.
“Remember my asking you about a boulder with piñon trees growing
out of it? Well, that place is up yonder in Pinecate Cañon. My name
isn’t Tompkins at all. It’s Pat Ramsay. Last year my brother Alec
came over here to spend a year in the desert and clear up his lungs.
He bought a place and vanished—clear vanished, and couldn’t be
traced. The last heard of him was from Stovepipe Springs. He wrote
me about a place he had bought, describing that boulder. I found
this up the cañon in a pack-rat’s nest. Look it over while I get the car
ready.”
He gave the cigarette case to the staring desert rat, then turned
and went back to his own car. When he got this out of the brush, he
removed most of the load and hid it securely among the trees. This
done, he returned to Sagebrush, who was sitting on the running-
board of Hassayamp’s car examining the deed.
“Anything I can do for your arm?” he asked.
“Nope. Bone aint hurt. Say, Perfesser, you’ve sure struck me all of
a heap! Still, I knowed you wasn’t the danged fool you looked.”
“Thanks.” Tompkins laughed curtly. “Now, Sagebrush, I’m going to
town, speak easy to everyone, and slide back here. First I want to
investigate that Hourglass Cañon, wherever it is—”
“I know where it is,” said Sagebrush, scratching his wealth of
whiskers.
“All right. Where do you come in on the program? Want to be left
out?”
Sagebrush produced his pipe and sucked at it. At length he made
slow answer.
“Perfesser, there’s some folks around here jest pining to be left
alone, and most gen’ally they gets left alone. That cholo Mendoza
was one such, and killin’ him aint botherin’ me none. Most likely
you’ve discounted Sidewinder Crowfoot?”
“My guess is that he’s the head of the whole gang.”
“Reckon ye aint far off. Now, so long as I aint bothered, I aint
troublin’ nobody. My motter is never to bother a rattler what’s a gent
and sounds his rattles—but if he acts like a sidewinder, then bash his
head, and do it pronto! Yestiddy you asks if I’ll help keep this yere
female from gettin’ skun, and I says no. I still aint int’rested nohow.
But two of that danged crowd have set in on me with a cold deck
this mornin’, and I’m plumb riled. Yessir, I’m riled!”
Sagebrush stood up. His bent figure straightened a trifle, and a
sudden savage expression showed in his eyes, half masked behind
the hairy growth of whiskers. In a flash all his dirt and squalor, all his
unkempt and sun-bleached appearance, was gone in the eyes of
Tompkins; he saw there a desert man who cared nothing for
externals, but who could cope daily with the bitterest and most
fearful forces of nature—and who was now ready to turn his inward
strength against men. The drab and plodding desert rat suddenly
showed, for one flashing moment, what unsuspected depths of
character lay within him; and a rush of anger unbarred the
floodgates of his reticence.
“Yessir, I’m riled! I’ve seen them goin’s-on and said nothin’. I’ve
seen them outlaws rulin’ the roost around yere and said nothin’.
’Twan’t no skin off’m my nose. I hadn’t no call to butt in. I’ve seen
folks come in yere right happy, and seen ’em go out skun and
mis’able and busted. I’ve seen one feller after another come in yere
with the law two jumps behind him, and he goes over to Hourglass
Cañon and lives happy. No law reaches in yere; nobody dast to
interfere; and nobody knows about it anyhow. Stovepipe Springs,
dad blame it, is jest a blind! If any law-off’cer comes pirootin’
around, he gits steered plumb careful and goes away ’thout learnin’
nothin’. But now, by gosh, I’m riled! Yessir. Perfesser, I’m with ye six
ways from Sunday. Them skunks have sold us chips in this yere
game, and by gosh I’ll play them chips till hell freezes over! Name
your ante, Perfesser, and let’s go.”

Sagebrush relaxed. He stuck his pipe in his pocket, brought out


his plug and bit off a large section. Tompkins, taking the cigarette
case and pocketing it, nodded.
“Good. I’m going to get a rifle in town and come back tomorrow
morning without anyone suspecting what I have in mind. Then I’ll be
Pat Ramsay once more. Want to go to town with me?”
“Reckon not,” said Sagebrush reflectively. “Mesquite was headin’
for town, and him and me would sure collide. That might spoil your
hand. And say! I remember that brother o’ yours. I seen him with
Mesquite one time. He looked a heap like you do ’thout them spec’s
and all.” Tompkins produced his pocket flask, opened it and held it
out.
“Here’s to our luck, Sagebrush! Good hunting!”
With a grunt of delight, Sagebrush lifted the flask and absorbed
his share of the contents; Tompkins finished it off, undisturbed by
any thought of rock scorpions, eyed the empty glass container, and
with a laugh tossed it into the clump of trees.
“Then I’m off. I’ll be back in the morning. Have to send that deed
to be recorded. Anything you want from town?”
Sagebrush wiped his lips and nodded.
“Yep. There’s jest one feller there ye can trust—Haywire Johnson,
up to the hotel. Register that deed and send by him and tell him to
shet up about it. Otherwise, that durned Hassayamp will poke his
nose into it. Then tell Haywire to give you that there gun he’s
keepin’ for me. I don’t aim to carry more’n one gun these days, not
havin’ much use for it, and Haywire has been keepin’ my other one.
I’ll mosey up this yere cañon and have breakfast ready for ye in the
mornin’. Git out early.”
With another nod, Tompkins climbed into his car, started the
engine, and started away. He knew well enough that Sagebrush
would carefully avoid meeting Hassayamp and Miss Gilman.
What most stirred in his mind, however, as he headed for town,
was that mention of his brother and Mesquite Harrison—and
Mesquite was now in town. Taken in conjunction with Crowfoot’s
recommendation, here was a chance not to be missed.
“I’ll sure interview Mr. Harrison and give him the time of his life
before I’m done with him!” thought Tompkins, and he glanced at the
sun. “Hm! I can get to town and clean up everything before supper.
Then I’ll want to see Miss Gilman. She must be persuaded to get out
of here at once. Hm! Queer how old Sagebrush showed up. To all
appearance, he’s a comic-supplement character; put him on a city
street and he’d gather a crowd—but how many of that crowd would
last a week with him on the Mohave? These smart Alecs back East
who think Europe is better than America and who part their hair the
way the Prince of Wales does it, and who look on everyone west of
Newark, N. J. with supreme contempt—wouldn’t I like to see ’em get
out in the desert with old Sagebrush, though! They’d find out what
sort of man it was who made this country what she is.”
It did not occur to him that in undertaking to play a lone hand
against the Hourglass Cañon gang, he was likewise carrying out
certain traditions of Americanism.
CHAPTER VII
The First State Bank of Stovepipe Springs had no banking hours,
but was open whenever Sidewinder Crowfoot was there. It was
nearly supper-time when Percival Henry J. Tompkins entered; and
Sidewinder gazed at him in astonishment.
“Thought you were off bug-hunting!”
Tompkins shook his head sadly.
“I regret to say, sir, that the man whom I had engaged proved to
be an unworthy rascal. I refer to Mr. Beam. In common parlance, he
was drunk, insisted on taking me in the contrary direction to that
which I desired, and even threatened me with a revolver. I
abandoned him in the desert, but had I not encountered Miss
Gilman and Mr. Foster, I might never have found my way back to
town. Here is your receipt, sir, and I shall have to withdraw my
money temporarily until I can recompense Mr. Foster for his
assistance and make certain purchases. Tomorrow I hope to start off
again with a new guide.”
The glittering gray eyes of Sidewinder were masked for a
moment, then shot up.
“That’s right good news!” he exclaimed. “That feller I
recommended to you, Mesquite Harrison, is here in town right now.
Want to see him?”
“By all means!” said Tompkins gratefully. “If he can come to the
hotel later on this evening, I shall be very glad—or, let us say, early
tomorrow morning. I shall be up with the sun, and I trust early rising
will not discommode him?”
“None to mention,” said Sidewinder, and took an envelope from
his safe. “Here’s your money. Bring back what you got left tomorrow,
and we’ll take care of it.”
“Thank you—thank you very much,” said Tompkins, and departed.
Halting at the garage to see that fresh supplies of fuel were put
aboard the flivver, which he left standing in the street, he walked on
down to the hotel and found Haywire Johnson in the office, alone.
Mr. Tompkins produced a ten-dollar gold-piece and laid it under the
eyes of the startled Haywire.
“Want to earn that, partner?” he asked in his natural voice.
“Gosh, yes!” said Haywire promptly. “Whose mail d’ye want?”
“Nobody’s. Give me an envelope and some sealing-wax.” When he
was supplied, Tompkins wrote a short note, inclosed with it the deed
to Alec Ramsay’s property in Pinecate Cañon, addressed the
envelope to the recorder in Chuckwalla City, and sealed it up. Then
he gave it to Haywire.
“Register this, and slip it into tomorrow morning’s mail-sack
without giving Hassayamp a squint at it. That earns the first ten.”
Tompkins now produced a second gold-piece, at which Haywire
goggled frantically. “Here’s another you can earn. Go over to Pincus’
store and buy me a rifle with a box of cartridges—”
“Hold on, Puffesser!” broke in Haywire, quickly. “I got one I’ll sell
cheap. Good gosh, yes! Five year old, but better’n they make ’em
now. Distance sights.”
“All right. Sneak it into my room with a box of cartridges to fit,
and I’ll pay you for it; bring along that gun you’re keeping for
Sagebrush Beam, too. He wants it. There’s the other ten. You’ll earn
it by keeping your mouth shut real tight. And listen! Will you or
Hassayamp be on deck along about sunup in the morning?”
“Hassayamp wont; that’s certain,” said Haywire, staring at
Tompkins. “I’m liable to be, if ye want me.”
“All right. You know Mesquite Harrison? He’s coming to see me.
Bring him right to my room, savvy? Then if you hear him yell, be
deaf in both ears, and if you see anything funny going on, be blind
in both eyes.”
“All right, Puffesser. Gosh, ye don’t talk like the same feller ye was
—”
“Never mind. Your job is to be a human sphinx. Supper ready?”
“Bell’s just about to ring, Puffesser. I’ll be along d’rectly.”
Seeking his own cell, Tompkins enjoyed a thorough wash-up, and
before he finished heard signs of life in the adjoining room which
tokened that Miss Gilman had returned. On his way to the dining-
room he encountered Hassayamp, looking more melancholy than
ever, and was given a cheerless nod; then a flicker of interest seized
the hotel-proprietor.
“Say, Puffesser! Thought you aimed to stay awhile in the desert?”
“So I did, Mr. Foster,” said Tompkins blandly. “So I did. But I regret
to say that I had trouble with my companion. Perhaps you observed
that I was alone when we met each other this afternoon? Luckily I
was able to follow the tracks of your car back to town, or I might
have been lost. I trust your stomach trouble has quite passed over?”
“More or less,” said Hassayamp, and went his way.
Tompkins went in and dined heartily, now confident that even if
Hassayamp and Sidewinder got together in conference during the
evening, they would be unable to figure him out to any great extent.
When Miss Gilman appeared at her table, she gave Tompkins a
smiling nod, and he perceived that her day on the burning sands
had done its work well.
“Cold cream is recommended,” he exclaimed. “May I inquire
whether you will view the beauties ol the sunset this evening in my
company, madam?”
“I shall be charmed—Perfesser,” she responded, and Tompkins
grinned.
There was no sunset to view that evening, however. When they
met in front of the hotel, a keen wind was coming down off the
Chuckwalla hills, and clouds had appeared like magic in the sky.
They walked together in silence toward the deserted buildings of the
old boom town, until Tompkins spoke.
“We’ll have snow upon the desert’s dusty face in the morning. Old
Omar Khayyam sure had been there! I’ve seen an inch of snow on
the Mohave at sunrise, and it’d be gone in an hour. This is probably
the tail-ender of the season—rains are all over now. Well, how did
you find everything up the cañon?”
“It was just as described in that deed,” she said soberly. “Oh, I’m
sorry for the way I spoke the other night! I didn’t think it could be
possible, Mr.—shall I call you Tompkins or Ramsay?”
“Neither one,” he responded with a whimsical smile. “Call me Pat.”
“No. I think you don’t need any encouragement to impertinence.”
And she laughed. “But really—that cañon was a dream of beauty!
There was water, running and in pools, and all sorts of lilies were
there, and flowers—”
“Sure, a regular desert cañon after the rains,” said Tompkins. “And
not very far away, a dead man.”
“Oh, I didn’t mean that! I didn’t want to think of your brother as
—”
“I’m not talking about him. Another man.”

She gave him a startled look. “You mean a man was killed out
there?”
“Yes, and another wounded. Several are going to be killed in the
near future, if I’m any judge. You needn’t look alarmed about it, Miss
Gilman; they’re outlaws. I’ve opened up the whole situation pretty
well, I think. Now, I hope you’ll take my advice and get out of this
town tomorrow morning on the stage. I expected to be gone about
sunrise, as I have work waiting for me out yonder, but if you think
you’ll need any moral backing in drawing out of the game, I’ll stay
and see you through.”
“No, thanks,” she returned quietly. “I’m staying.”
“After what I’ve told you and showed you?” he said with a frown.
“Yes. Now let me explain, and don’t get too bossy. Hassayamp
wanted to sell me that claim belonging to your brother; it’s one of
the most beautiful spots I ever saw. However, I made some excuse
about it not being suited to chickens, and I’m going to buy the five
acres adjoining it and just above. You wait till you see that place! It’s
got—”
“My dear girl,” said Tompkins, “don’t you know chickens can’t be
raised here, without large and expensive precautions?”
“Oh, I’m not quite a tenderfoot. Chickens or not, I’m going to own
that piece of land! And I’ve taken warning from you, too, because I’ll
not turn over the money until the title is clear and the deed
recorded. The five acres cost me three hundred dollars, mineral
rights and all. Hassayamp owns it. He showed me where a mine
used to be—it’s played out now. I don’t care a bit if the place is
never any real good to me; I’m going to keep it just to live on when
I get old, and enjoy it. Why, you get a wonderful view from the
upper cañon out over the desert!”
“Well,” said Tompkins reluctantly, “since your eyes are open, I
can’t of course make any more objections, though you can buy
plenty of desert cañon for less money. But what about transport?”
“I’ve bought Hassayamp’s car. It’s an old one, but I know all about
a flivver and it will do me. Then, I’m going to get a big tent set up
there—”
Tompkins groaned inwardly, but presently changed the subject. It
was no use whatever to raise up practical objections; the girl would
have to find things out for herself. She was obviously determined on
her course, and the more he saw of her, the more he began to feel
that she was a pretty competent young woman. In fact, as they
walked and spoke of cabbages surd kings, he was distinctly and
unpleasantly surprised to find that it had grown dark and very cold,
and that they must return to shelter immediately. When they had
reached the adobe cells that constituted the hotel, he paused at her
door and shook hands.
“From now on, Miss Gilman, my name’s Ramsay—only you’ll come
to calling me Pat, especially if we’re to be neighbors. If you have any
need of me, don’t hesitate to summon me. I believe Haywire
Johnson is a good sort, and you may confide in him any time. And
by the way, if you hear any queer noises early in the morning, don’t
call for help.”
“I usually don’t,” she said, smiling. “Why?”
“One of the men who murdered my brother is coming to call on
me, I hope.” The smile died on her lips. Her eyes widened on him.
“You mean it? But—but surely you—you don’t intend—”
“We’re going to have a talk; that’s all,” said Tompkins. “Good
night, and pleasant dreams! I’ll see you again. Don’t forget to look
through your blankets for stray lizards.”
He went on to his own cell, and in twenty minutes was sound
asleep.

With dawn, Tompkins, or as he was now to become, Pat Ramsay,


wakened to a glorious sunrise just breaking over a transformed
world. As he had predicted, snow had come during the night.
Everything was covered with a soft white garment, unusual but by
no means unheard-of in the desert, which would be gone again in
an hour.
He shaved and made his ablutions and got ready to travel. He
inspected the rifle which Haywire had left in his room, and found it
good. He was still looking it over when Haywire himself knocked at
the door.
“Say, Puffesser! Mesquite is out there—” “All right, bring him right
along. Hold on! I want to settle with you for this gun. And where’s
that revolver that Sagebrush wanted?”
“Got it right here, Puffesser—”
Taking the old forty-five that was handed him, Ramsay paid for his
rifle and then swiftly made ready for his visitor. He pulled down the
blind of the window, partly darkening the room, then rubbed his face
with talcum powder and seated himself without glasses or helmet,
with his back to the door, the rifle in his hand. After a moment came
steps, then a knock.
“Come in,” he said.
Mesquite Harrison stepped into the room and stood blinking at the
swift transition from snow-dazzle to this obscurity. He was a
cadaverous person with straggling mustache and rudimentary chin,
adenoidal mouth and projecting front teeth; his entire countenance
was stamped with viciousness and weakness, and one glance
showed Ramsay that his ruse was bound to succeed.
“Heard ye wanted a guide,” said Mesquite.
“I wanted you,” said Ramsay, “and I came back to get you.”
He swung his chair around so that the light struck his face.
Mesquite Harrison uttered one low gasp, and then stood
absolutely petrified, struck into helpless, motionless silence. His
mouth opened, and his piggish eyes widened into round disks. He
stood with hands thrown back against the door, and a ghastly pallor
crept across his horrified countenance.
“Thought you were safe when you knew I was dead up there in
Pinecate Cañon, didn’t you?” said Ramsay, in a hollow voice. “You
thought that after shooting me through the lungs you were safe, eh?
But you’re not. I’ve come back to get you! Don’t move a muscle, or
I’ll put a bullet through you.”
His likeness to the vanished Alec Ramsay was strong—so strong
that the wretched Mesquite Harrison made no query about how a
ghost could shoot a rifle. This interesting conundrum was about the
farthest thing from Mesquite’s mind at the moment. His distended
eyes were fastened in horror upon the face of Ramsay, and now a
low wail broke from him.
“Leave me be, fer Gawd’s sake!” he howled. “It wasn’t me! It was
Cholo Bill and Tom Emery done it—I was jest trailin’ along with ’em
that day! It was Tom Emery fired that shot! Leave me be and I’ll be
good—”
He plumped down on his knees, and his teeth began to chatter
with fright.
“All right,” said Ramsay in contempt. “Get up! Turn around and
walk out that door and walk out to the street. Then start going—and
keep going. Head for Meteorite, and don’t stop. I’ll be right back of
you until you get there. You can’t see me after we get out of town,
but I’ll be there. Get going!”
The unhappy Mesquite lost no time in obeying. He flung open the
door, darted outside, and started for the street. Ramsay followed
more leisurely. When he passed through the hotel front, he saw
Mesquite standing outside, staring back, and as Ramsay appeared in
his wake, the thoroughly frightened rascal uttered another howl and
started for Meteorite.
“Don’t ever come back here or I’ll get you!” called Ramsay, and
the last he saw of Mesquite Harrison, the latter was plugging along
through the snow, head down and arms going as he ran. Ramsay
turned a back into the hotel office, and met the stare of Haywire.
“Gosh!” said the latter. “What’d ye do to him, Puffesser?”
Without replying, Ramsay went on back to his room. There he got
his belongings together and carried them to the car, which was
standing in the street. While he was putting them into the flivver, he
saw Hassayamp appear at the front door of the hotel, yawning
mightily. Ramsay jerked off his glasses and sun-helmet, and went up
to Hassayamp. In the latter’s startled gaze he read instant
recognition, for this was the first time Hassayamp had ever seen him
without the yellow goggles.
“Listen here!” said Ramsay, tapping melancholy Hassayamp on the
arm and boring into him with stern gaze, “I suppose you thought
that little escapade of yours back in St. John’s, Arizona, a good many
years ago, had been forgotten, eh?”
Hassayamp turned white. Whether or not he recognized his
interlocutor as singularly like the vanished Alec Ramsay in looks, he
certainly recognized the remarkable change of voice and manner in
the supposed professor. Mention of St. John’s brought the pallor to
his cheeks. Over his shoulder gaped Haywire, intensely interested.
“Well,” continued Ramsay, “it hasn’t been forgotten, my friend.
One of my errands here was to remind you of the occurrence. If I
were you, I wouldn’t rely too much on the protection of Sidewinder
Crowfoot. The theft of horses may be forgotten with the years; but
what about that church money you stole, eh?”
“I—I’ll pay it back,” stammered Hassayamp, now convinced that
the Mormons were on his trail.
“You wont get the chance. If I didn’t have other and more
important fish to fry, I’d attend to you right now. But I guess you’ll
keep until I get back. Then you’ll come along with me.”
Hassayamp turned yet whiter. The Southwest has by no means
forgotten the days of Mountain Meadow and the avenging angels of
Mormon; and while in these more settled times the followers of that
faith are certainly guiltless of any ill-doing, there is an heritage of
uneasiness that lingers about the very name of Mormon and will not
be stilled.
So Ramsay strode out to his car, donned goggles and helmet, and
went chugging away to get his breakfast at Pinecate Cañon.
CHAPTER VIII
Sagebrush, who had camped at the entrance of the cañon,
listened with hearty approval to Ramsay’s recital of the morning’s
events. His roar of laughter echoed back from the rocky walls and
went thundering away up toward the mesa.
“Durned if I’ve laughed so much since my ol’ woman run off!” he
exclaimed. “Shootin’s too good for that coyote Mesquite, anyhow.
He’ll run into jail to Meteorite, ’cause he’s wanted there for robbin’
an Injun off the reservation last year. Yessir! That’s how mean that
pesky critter is. Done robbed an Injun squaw what had been sellin’
beadwork to tourists on the trains.”
“Do you know those men he mentioned as the actual murderers?”
queried Ramsay.
“Nope. Never heard o’ Cholo Bill—most likely he’s a halfbreed
greaser, same’s that cuss Mendoza. Tom Emery’s different. He’s a
bad man, real bad. Got out o’ jail in Arizona two year back,
murdered a rancher in the White Mountains, and skipped out. I
reckon there’s a reward for him.”
“All right. You collect all the rewards—what I’m after is scalps.”
“That suits me, Perfesser. She goes as she lays. What’s the
program?”
Ramsay, having finished his breakfast, lighted his pipe and
considered.
“The thing to do, of course,” he said tentatively, “is to apprise the
nearest legal officers of conditions, get the sheriff to work, and
round up the gang.”
Sagebrush eyed him askance, in no little astonishment.
“Is that there your program, then?”
“No.” Ramsay’s blue eyes twinkled. “No, it isn’t. I only mentioned
it as the proper thing.”
“If we all done the proper thing, this would be a hell of a world,”
and Sagebrush sighed in relief. “I nominates that we light a shtick
out o’ yere, go over to that there Hourglass Cañon, and clean her
up. Everybody there is wanted, you betcha!. We don’t need no
warrants, nor no officers fussin’ around to see things is done right.”
“Nomination seconded,” said Ramsay promptly. “How far is it from
here?”
“Hold on,” warned the desert rat. “This aint no picnic party,
Perfesser. We got to git busy ’fore Sidewinder gits busy, but there’s
no sense to rushin’ things. We can’t take no autybile over there. We
got to hike. Ground’s durned rocky and rough. Yessir! We’re headin’
east on a rough and rocky road, and no mistake. That’s one reason
nobody aint never follered none o’ that gang to the roost. Nobody
much hint been along this yere range for ten or twelve year—she’s
got the repytation of havin’ petered out. You and me can prob’ly git
there sometime tonight, ease up the cañon, git the lay of the land
toward sunup, and git into action. Wipe out the hull durned batch!”
Ramsay frowned. “That’s a trifle bloodthirsty, isn’t it? I want those
two murderers; if I can get ’em alive to stand trial, all right. If not—”
“They’re all in the same kittle,” snapped Sagebrush. “Wipe ’em
out! Yessir! I’m riled. But no sense goin’ too fast. We got to see
who’s there and how many, and what things look like. That there
cañon is shaped like the figger X, and where the lines cross is a right
narrer gap. The back end is a box cañon, all right, with durned steep
walls and lots of timber. Only green spot this side o’ them hills. Last
time I was there was ten year back, when Chuck Martin busted his
whiffletree, and we rode over yere to find a new stick. We had some
liquor along them days, and Chuck he took a drap too much and
went to sleep in an ol’ shack, and when he woke up it was dark, and
they was a hull passel o’ ’phoby skunks holdin’ a carnival, and Chuck
busted up the dance ’fore he knowed what it was. Gosh, I can smell
him yet when I think of it. Yessir, ‘Look ’fore you sleep’ is a dad-
blamed good rule to foller in these ol’ shacks—and anywheres else
too, I reckon. Well, I’ll git the packs made up while you clean camp.”
The two men set to work. After the flivver was laid out of sight in
the clump of piñon trees and thorny mesquite, the loads were
assembled, and within twenty minutes the partners were on their
way. What with grub and blankets, rifle and water-bag, Ramsay had
all the weight to carry that he wanted, and he faced the prospect of
a full day in rocky desert ground with a grimace.
His expectations were entirely fulfllled. Sagebrush led the way,
skirting the high and precipitous mesa for a time and then striking
directly off toward the hills to the northeast. The abundance of rocks
showed Ramsay that no flivver could hope to cover this ground; the
snow had all vanished long since, and no trace of moisture remained
to mark its passing.
Fortunately for Ramsay, the old desert rat was used to the slow
burro pace, and shuffled along at a steady plodding gait which was
not difficult to sustain, and which ate up the distance slowly but
surely. To anyone not used to it, there was something terrible in the
thought of thus shuffling across the desert day in and day out for
years, eternally seeking the yellow dust; and yet men did it,
hundreds of them, and were not happy unless doing it.
Pat Ramsay faced the project which lay ahead of them, unblinking
the facts, and not shirking what was to be done. He now knew what
before he had only conjectured. Impossible as it seemed, he knew it
to be true. Here at this back door of civilization existed a number of
men whose business in life was robbery and if necessary murder—an
abnormal situation, to be handled with other than normal methods.
Ramsay was no innocent in the waste places. He knew that in these
vast stretches of desert country there existed strange things, that in
this apparently empty basin of forgotten seas there were still
unsolved problems and undiscovered wonders. If he was to go
seeking the men who had murdered his brother, he must put away
all thought of haling them before the bar of justice; the only justice
which obtained in the desert was that of the strong hand and the
inexorable requisitions of nature. If men offended the laws of
nature, a terrible punishment was exacted from them. If they
offended the laws of man, as they did every day, the ordinary
machinery of man’s justice could not always reach them—and they
knew it.
“By gosh,” said Sagebrush, when they halted at noon in the shade
of a towering pinnacle of rock, “ye done a good stroke when ye got
to work this mornin’ and cut off Sidewinder from them fellers
yonder! Yessir! I’d think twicet or maybe three times ’fore I tackled
that there gent. Most likely that cholo and Mesquite rode in to git
supplies, and cuttin’ them off was a right smart piece o’ work. Wisht
we had a hoss apiece! Sing out next you see a nice fat chuckwalla.
I’d like to git me a good chunk o’ lizard-tail for supper, Per-fesser.”

Before they had left the overhanging rock, indeed, Sagebrush


located a fine big lizard and staged a battle royal. The lizard,
ensconced in a rock cranny, inflated himself and could not be
dislodged for all the tugging of Sagebrush, who in the end was
content with taking the tail. This the chuckwalla gladly surrendered,
and Sagebrush stowed it away in his pocket after Ramsay refused to
share the delicacy.
The afternoon drew on. They did not hurry; yet the ground was
covered steadily, and no moving object broke the dun expanse of
glaring rock and sand. Gradually they approached a patch of green
high on the hills, which served as landmark, but the entrance to
Hourglass Cañon itself did not open up before them. When the sun
was drawing down to the western horizon, Sagebrush halted.
“No use goin’ on now—we’ll be in the cañon in half an hour and
can’t take no chances. Goin’ to be a clear night, and cold as hell.
Why don’t preachers make hell a cold place, Perfesser? Dad blame if
I can see anythin’ ornery in hell the way it’s laid out. I bet it aint no
hotter’n the Ralston Desert up in Nevada, and that don’t stack up
noways alongside what Imperial Valley used to be ’fore they started
growin’ melons and garden truck there. Reckon I’m goin’ to freeze
tonight ’thout no fire, but can’t be helped. Let’s git our victuals
washed down, and then we’ll mosey along and take it easy till dark.”
When the sun was down, they moved on again, and before the
last of the daylight died into the starry radiance of night, Ramsay

You might also like