About	This	E-Book
EPUB	is	an	open,	industry-standard	format	for	e-books.	However,	support	for
EPUB	and	its	many	features	varies	across	reading	devices	and	applications.	Use
your	device	or	app	settings	to	customize	the	presentation	to	your	liking.	Settings
that	you	can	customize	often	include	font,	font	size,	single	or	double	column,
landscape	or	portrait	mode,	and	figures	that	you	can	click	or	tap	to	enlarge.	For
additional	information	about	the	settings	and	features	on	your	reading	device	or
app,	visit	the	device	manufacturer’s	Web	site.
Many	titles	include	programming	code	or	configuration	examples.	To	optimize
the	presentation	of	these	elements,	view	the	e-book	in	single-column,	landscape
mode	and	adjust	the	font	size	to	the	smallest	setting.	In	addition	to	presenting
code	and	configurations	in	the	reflowable	text	format,	we	have	included	images
of	the	code	that	mimic	the	presentation	found	in	the	print	book;	therefore,	where
the	reflowable	format	may	compromise	the	presentation	of	the	code	listing,	you
will	see	a	“Click	here	to	view	code	image”	link.	Click	the	link	to	view	the	print-
fidelity	code	image.	To	return	to	the	previous	page	viewed,	click	the	Back	button
on	your	device	or	app.
Sams	Teach	Yourself,	Godot	Engine
Game	Development	in	24	Hours
Ariel	Manzur
George	Marques
CONTRIBUTORS:
Poommetee	Ketson
Thomas	Herzog
Emmanuel	Leblond
Tiamo	Pastoor	(Pandaqi)
Anna	Daubenspeck
Jakob	Schwab
800	E.	96th	St.,	Indianapolis,	IN	46240	USA
Sams	Teach	Yourself	Godot	Engine	Game	Development	in	24	Hours
Copyright	©	2018	by	Pearson	Education,	Inc.
All	rights	reserved.	Printed	in	the	United	States	of	America.	This	publication	is
protected	by	copyright,	and	permission	must	be	obtained	from	the	publisher
prior	to	any	prohibited	reproduction,	storage	in	a	retrieval	system,	or
transmission	in	any	form	or	by	any	means,	electronic,	mechanical,
photocopying,	recording,	or	likewise.	For	information	regarding	permissions,
request	forms,	and	the	appropriate	contacts	within	the	Pearson	Education	Global
Rights	&	Permissions	Department,	please	visit
www.pearsoned.com/permissions/.	No	patent	liability	is	assumed	with	respect	to
the	use	of	the	information	contained	herein.	Although	every	precaution	has	been
taken	in	the	preparation	of	this	book,	the	publisher	and	author	assume	no
responsibility	for	errors	or	omissions.	Nor	is	any	liability	assumed	for	damages
resulting	from	the	use	of	the	information	contained	herein.
ISBN-13:	978-0-13-483509-9
ISBN-10:	0-13-483509-3
Library	of	Congress	Control	Number:	2017963657
1				18
Trademarks
All	terms	mentioned	in	this	book	that	are	known	to	be	trademarks	or	service
marks	have	been	appropriately	capitalized.	Sams	Publishing	cannot	attest	to	the
accuracy	of	this	information.	Use	of	a	term	in	this	book	should	not	be	regarded
as	affecting	the	validity	of	any	trademark	or	service	mark.
Warning	and	Disclaimer
Every	effort	has	been	made	to	make	this	book	as	complete	and	as	accurate	as
possible,	but	no	warranty	or	fitness	is	implied.	The	information	provided	is	on	an
“as	is”	basis.
Special	Sales
For	information	about	buying	this	title	in	bulk	quantities,	or	for	special	sales
opportunities	(which	may	include	electronic	versions,	custom	cover	designs,	and
content	particular	to	your	business,	training	goals,	marketing	focus,	or	branding
interests),	please	contact	our	corporate	sales	department	at
corpsales@pearsoned.com	or	(800)	382-3419.
For	government	sales	inquiries,	please	contact
governmentsales@pearsoned.com.
For	questions	about	sales	outside	of	the	U.S.,	please	contact
intlcs@pearson.com.
Publisher
Mark	Taub
Acquisitions	Editor
Laura	Lewin
Managing	Editor
Sandra	Schroeder
Project	Editor
Prathiba.R/Pearson	CSC
Copy	Editor
Pearson	CSC
Indexer
Pearson	CSC
Proofreader
Pearson	CSC
Technical	Editor
Ariel	Manzur
Editorial	Assistant
Courtney	Martin
Cover	Designer
Chuti	Prasertsith
Compositor
Pearson	CSC
Contents	at	a	Glance
Foreword
Preface
HOUR	1	Introducing	the	Godot	Engine
HOUR	2	Scene	System
HOUR	3	2D	Graphics
HOUR	4	Scripting
HOUR	5	Game	1:	Space	Shooter
HOUR	6	More	Scripting
HOUR	7	Handling	Input
HOUR	8	Physics	System
HOUR	9	User	Interface
HOUR	10	Animation
HOUR	11	Game	Flow
HOUR	12	File	System
HOUR	13	3D	Graphics
HOUR	14	Project	Management
HOUR	15	Materials	and	Shaders
HOUR	16	Lights	and	Shadows
HOUR	17	Game	2:	Bloxorz	Clone
HOUR	18	Environments
HOUR	19	Sound
HOUR	20	Particle	System
HOUR	21	Viewports	and	Canvas
HOUR	22	Networking
HOUR	23	Game	3:	Networked	Bomberman	Clone
HOUR	24	Exporting	the	Project
BONUS	HOUR	25	Native	Code
Index
Table	of	Contents
Foreword
Preface
HOUR	1:	Introducing	the	Godot	Engine
Installing	Godot
Creating	a	Project
Using	the	Visual	Editor
Setting	Up	a	Main	Scene
Summary
Q&A
Workshop
Exercises
HOUR	2:	Scene	System
Nodes	and	Scenes
Resources
Combining	Scenes
Managing	Subscenes
Summary
Q&A
Workshop
Exercises
HOUR	3:	2D	Graphics
Sprites	and	Draw	Order
Vectors	and	Transforms
Cameras
TileMaps
Summary
Q&A
Workshop
Exercises
HOUR	4:	Scripting
Node	and	Script	Relationship
Introduction	to	GDScript
Signals	and	Groups
Summary
Q&A
Workshop
Exercises
HOUR	5:	Game	1:	Space	Shooter
Concept	and	Design
Making	the	Scenes
Summary
Q&A
Workshop
Exercises
HOUR	6:	More	Scripting
Notifications
Singletons	and	Autoloads
Summary
Q&A
Workshop
Exercises
HOUR	7:	Handling	Input
Input	Basics
InputEvent	Class
Keyboard	and	Joystick	Input
Mouse	and	Touch	Input
Input	Mapping
InputEventAction
Summary
Q&A
Workshop
Exercises
HOUR	8:	Physics	System
Bodies	and	Shapes
Types	of	Physics	Bodies
Areas	and	Presence	Detection
Ray	Casting
Navigation	and	Path	Finding
Summary
Q&A
Workshop
Exercises
HOUR	9:	User	Interface
Control
Know	Your	Controls
Containers
Making	an	Interface
Theme
Custom	Control
Summary
Q&A
Workshop
Exercises
HOUR	10:	Animation
Animation	Editor
Timeline	and	Keyframes
Blending	and	Transitioning	Animations