Programming For Game Design: A Hands-On Guide With Godot 1st Edition Wang All Chapter Instant Download
Programming For Game Design: A Hands-On Guide With Godot 1st Edition Wang All Chapter Instant Download
com
https://ebookmass.com/product/programming-for-game-design-a-
hands-on-guide-with-godot-1st-edition-wang/
OR CLICK HERE
DOWLOAD NOW
https://ebookmass.com/product/programming-for-game-design-a-hands-on-
guide-with-godot-1st-edition-wallace-wang/
ebookmass.com
https://ebookmass.com/product/programming-for-game-design-a-hands-on-
guide-with-godot-1st-edition-wallace-wang-2/
ebookmass.com
https://ebookmass.com/product/game-programming-with-unity-and-c-a-
complete-beginners-guide-2nd-edition-casey-hardman/
ebookmass.com
https://ebookmass.com/product/fungipedia-a-brief-compendium-of-
mushroom-lore-lawrence-millman/
ebookmass.com
The Psychology of Investing 6th Edition, (Ebook PDF)
https://ebookmass.com/product/the-psychology-of-investing-6th-edition-
ebook-pdf/
ebookmass.com
https://ebookmass.com/product/nutrition-for-sport-and-exercise-4th-
edition-j-andrew-doyle/
ebookmass.com
Wallace Wang and Tonnetta Walcott
Tonnetta Walcott
El Cajon, CA, USA
This work is subject to copyright. All rights are solely and exclusively
licensed 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.
The publisher, the authors, and the editors are safe to assume that the advice
and information in this book are believed to be true and accurate at the date
of publication. Neither the publisher nor the authors or the editors give a
warranty, expressed or implied, with respect to the material contained
herein or for any errors or omissions that may have been made. The
publisher remains neutral with regard to jurisdictional claims in published
maps and institutional affiliations.
Tonnetta Walcott
is a writer, podcaster, gamer, and
programmer who is passionate about video
games and technology. She graduated from
San Diego State University with a
bachelor’s in English and has a certificate
in computer programming. After being
offered an internship at Sony Online
Entertainment, Tonnetta learned computer
programming (C++ and Java), web
development, and game design using the
Unity and Godot game engines. Tonnetta
has programmed a simulation to chess,
Battleship, and a matching concentration
game and is currently working on a game
called NinChibi, where tiny chibi ninjas
play tag in single-player and multiplayer modes. The NinChibi game is
built with the Godot game engine.
About the Technical Reviewer
Massimo Nardone
has more than 27 years of experience in
security, web/mobile development, and
cloud and IT architecture. His true IT
passions are security and Android. He has
been programming and teaching how to
program with Android, Perl, PHP, Java,
VB, Python, C/C++, and MySQL for more
than 27 years. He holds a Master of
Science degree in Computing Science from
the University of Salerno, Italy. He has
worked as chief information security
officer (CISO), software engineer, chief
security architect, security executive, and
OT/IoT/IIoT security leader and architect
for many years.
© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2024
W. Wang, T. Walcott, Programming for Game Design
https://doi.org/10.1007/979-8-8688-0190-7_1
The best way to learn any new skill is to start practicing it and not be afraid
of making a mistake. To learn programming, you need to spend time
practicing on your computer, so before you go any further, download and
install the Godot game engine (https://godotengine.org) on your
computer. Once you’ve installed Godot, you won’t need to install any other
programs to write programs in Godot. Remember, practicing takes time and
patience in order to be good at something. Learning Godot is a fresh start!
The main steps to using Godot involve creating, editing, and running a
project. A project represents a complete video game. Each time you want to
create a different video game, you’ll need to create a separate project.
Godot isolates projects by storing them in different folders. The more
projects that you create, the more you’ll understand the mechanisms of
Godot. Still, it would be wise to focus on one project at a time to avoid
overload.
Although projects represent a complete video game, you may want to
create projects to test out different ideas. For example, you might want to
create a project to test out a combat system and another project to test out
an inventory system. Separate projects let you experiment with different
ideas in isolation, making them easier and faster to test without worrying
about integrating with the rest of an existing project.
While you can create as many projects as you wish, you’ll most likely
spend the bulk of your time editing an existing project rather than creating
new projects. Editing a project involves several tasks. The first way to edit
any project is to add assets such as graphic items to represent players,
obstacles, or background images. The best part of the project is that you can
be as creative as you want with your assets to your game. There are
different ways to create or obtain assets with enough research, so you don’t
have to make everything yourself.
Once you’ve added assets to a project, a second way to edit a project is
to modify the assets such as defining their position on the game field, their
size, their orientation, and their appearance. Assets have both a physical
appearance and a spatial location that you can define. Take as much time as
you need to modify and position your assets in order to build a fun,
playable, and functional game.
The appearance and position of assets create a static image. To make a
project interactive, you’ll need to write scripts that define how an asset
should behave when your project runs. A script is a code or program that
gives instructions to make assets function in a certain way. You will learn
more about scripts later on throughout this book. For example, a cartoon car
might need to avoid running into trees, telephone poles, and other cars. If
that should happen, then the cartoon car needs to change its appearance to
show the results of the crash. In addition, the cartoon car should also behave
differently after it’s been damaged.
In Godot, such scripts are written in a proprietary language called
GDScript, which resembles the Python programming language. Scripts let
assets in a project respond to user control through a keyboard or touch
screen and interact with other game assets.
A cartoon spaceship might fire lasers that can destroy asteroids in the
way. This might require a script to control and fire lasers from the spaceship
and another script for the asteroid to detect when it’s been hit by a laser.
Essentially, scripts make assets interactive and controllable by the user.
Editing a project lets you change the way the project looks and behaves.
To test if your project looks and works the way you want, you’ll need to run
the project periodically. These three steps (creating a project, editing a
project, and running a project) define the main actions you’ll take while
using Godot.
2. Click New in the upper left corner. A Create New Project dialog box
appears as shown in Figure 2-2. Godot requires that you create a new
folder for each project.
Figure 2-2 The Create New Project dialog box
3. Click the Browse button in the Project Path. A dialog box appears,
showing all the folders available.
4. Click a folder where you want to store your Godot project and click
Select Current Folder.
5. Click the Project Name text field and type a folder name to store your
project. (The default folder/project name is New Game Project.)
6. Click the Create Folder button.
7. (Optional) Click the Option button to choose a renderer version. For this
project, it doesn’t matter which renderer option you choose.
8. Click the Create & Edit button. Godot creates an empty project in the
folder that you selected in step 4.
Once you’ve created at least one Godot project, you can open that
project at a later time. To open an existing Godot project, follow these
steps:
1. Start Godot. Godot displays a Project Manager window (see Figure 2-1).
2. Click the Import button. An Import Existing Project dialog box appears
as shown in Figure 2-3.
3. Click the Browse button. A Directories & Files dialog box appears as
shown in Figure 2-4.
Figure 2-5 Look for the project.godot file stored in your Godot project folder
5. Click the project.godot file and then click the Open button. Godot loads
your chosen project.
If you had created or opened a project recently, the name of your project
may appear in the Project Manager window (see Figure 2-1). In that case,
you can skip all of the preceding steps and simply double-click the Godot
project you want to open that appears in the Project Manager window.
3. Click the Search text field at the top of the Create New Node window
and type node. The Create New Node window only displays those
options that contain the word “node” as shown in Figure 2-10.
Figure 2-10 Typing in the Search text field filters out the list of options
4. Click Node2D and click the Create button. Godot displays the Node2D
in the Scene dock, a cross representing the Node2D in the viewport, and
all the different properties you can change in the Node2D in the
Inspector pane as shown in Figure 2-11.
Figure 2-11 The Node2D in the Godot editor
5. Click the Node2D in the Scene dock to select it. To display a graphic
image on the Node2D, we need to attach another node, called a child
node, to the Node2D.
6. Attach a child node to the Node2D using one of the following methods
as shown in Figure 2-12:
Click the Add Child Node icon that appears as a + icon.
Press Ctrl+A (Windows/Linux) or Command+A (Macintosh).
Right-click, and when a pop-up menu appears, choose Add Child
Node.
7. Click the Search text field at the top of the Create New Node window
and type sprite.
8. Click Sprite2D and click the Create button. The Scene dock displays the
Sprite2D node as a child attached to Node2D as shown in Figure 2-13.
Figure 2-13 The Sprite2D child node attached to Node2D
9. Click Sprite2D in the Scene dock to select it. Notice that the Inspector
dock now displays properties you can modify.
10. Click <empty> in the Texture property in the Inspector dock. A pop-up
menu appears as shown in Figure 2-14.
Figure 2-14 The Texture pop-up menu in the Inspector dock
11. Choose Load or Quick Load. A dialog box appears as shown in Figure
2-15.
12. Click icon.svg and click Open. Godot displays the icon.svg graphic
image in the viewport as shown in Figure 2-16.
3. Click the close icon in the (DEBUG) window to stop running the
project.
You may wonder why the graphic image appears partially cut off in the
upper left corner of the (DEBUG) window. That’s because the upper left
corner is the default position every time you create a node. To see how to
view the contents of a scene, follow these steps:
1. Click the Node2D in the Scene dock to select it. Notice that the icon.svg
graphic image appears at the origin of an x axis (red horizontal line) and
y axis (green vertical line) as shown in Figure 2-19.
Figure 2-19 Displaying the Node2D in the viewport
2. Click the Distraction Free Mode icon in the upper right corner of the
viewport window twice. This icon toggles between expanding the
viewport window to fill the entire screen or shrinking it down to also
display the Scene, FileSystem, and Inspector docks on the left and right
side of the screen.
3. Click the – and + Zoom icons in the upper left corner of the viewport
window. The – icon decreases the magnification of the viewport
window, while the + icon increases magnification.
4. Click the – Zoom icon until the magnification displays 50%. At 50%
magnification, Godot displays a faint outline that defines the size of the
project window as shown in Figure 2-20. Notice that 50% magnification
makes it easy to see the entire project window boundary and how the
icon.svg appears cut off in the upper left corner of the window when you
run the project.
Figure 2-20 At 50% magnification, the viewport displays the faint outline of the project window
11. Drag the red and green arrows to position the Node2D in the middle of
the window outline.
12. Click the Run icon. The (DEBUG) window appears, but notice that the
icon.svg image now appears near the middle of the window where you
dragged the Node2D.
13. Click the close icon of the (DEBUG) window to stop running the
project.
6. Drag the red square right and left. Notice that this expands and shrinks
the width of the selected image.
7. Press Ctrl+Z (Windows/Linux) or Command+Z (Macintosh) to undo
any scaling you added along the x axis to the image.
8. Drag the green square up and down. Notice that this expands and
shrinks the height of the selected image.
9. Press Ctrl+Z (Windows/Linux) or Command+Z (Macintosh) to undo
any scaling you added along the y axis to the image.
10. Hold down the Shift key and drag either the red or green square. Notice
that when you hold down the Shift key, both the width and the height of
the image expand or shrink at the same time.
11. Press Ctrl+Z (Windows/Linux) or Command+Z (Macintosh) to undo
any scaling.
When you want to keep the proportion of the width and the height
constant, hold down the Shift key before dragging one of the scaling
squares. By using the Rotate and Scale icons, you can modify the
appearance of an image displayed in the viewport.
Summary
You should store every Godot project in a separate folder. That will keep
files from one project from accidentally interfering with files used in a
different project. While each project creates a complete video game, don’t
be afraid to create projects to test ideas out or to learn different features of
Godot.
A Godot project consists of one or more scenes where a scene can
represent a playing field, a single object, or parts of an object such as the
separate tires of a cartoon car. Scenes define what users see when they run
your project.
Scenes are made up of one or more nodes. Nodes contain properties that
you can modify in the Inspector dock. You may need to add multiple nodes
to include all the features you need for a particular object in your project. A
common node for displaying graphics is the Sprite2D node. There are many
types of nodes to work with, so do not be afraid to test out different nodes
that you may find suitable for your project.
Once you’ve created a scene, you can arrange objects in that scene
using the Move, Rotate, or Scale icons. The Move icon lets you place an
object on the screen. The Rotate icon lets you change the angle of an object
so that it appears tilted or on its side. The Scale icon lets you change the
height and width of an object.
The main steps to using Godot are creating and opening projects. Once
you open a project, you can edit it by adding, deleting, and changing scenes
through nodes that add additional features. Modifying a project defines
what users will see when your project runs.
Random documents with unrelated
content Scribd suggests to you:
The Project Gutenberg eBook of The lively
adventures of Gavin Hamilton
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.
Illustrator: H. C. Edwards
Language: English
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookmass.com