Code Monkey home page Code Monkey logo

devel-2d-games-unity's Introduction

Apress Source Code

This repository accompanies Developing 2D Games with Unity: Independent Game Programming with C# by Jared Halpern (Apress, 2018).

Cover image

Download the files as a zip using the green button, or clone the repository to your machine using Git.

Releases

Release v1.0 corresponds to the code in the published book, without corrections or updates.

Contributions

See the file Contributing.md for more information on how you can contribute to this repository.

Errata

Chapter 3, Page 53

Credit: @omundy

After stopping the playing scene, add the animation for the player's idle state. From the Sprites folder, select the last two sprites from the Player32x32 sprite-sheet, titled: Player32x32_12 and Player32x32_13 and drag them onto the PlayerObject. When prompted by the Create New Animation save window, name the created animation-clip, "player-idle" and save to the Animations -> Animations folder.

Chapter 4, Page 93

In the Creating Tile Palettes section, the Tile Palette window in Unity 2018.3 is now located under Window -> 2D -> Tile Palette.

Chapter 4, Page 128

Credit: @omundy

Make sure to attach the RoundCameraPos script to the virtual camera object. Drag and drop the RoundCameraPos onto "CM vcam1".

Chapter 4, Page 137

Credit: @omundy

The interface has been updated in Unity 2018.3. The menu item "Edit Physics Shape" has been renamed to "Custom Physics Shape". After selecting Custom Physics Shape, click the "Generate" button on the right before editing.

Chapter 5, Page 147

Credit: @omundy

Create the GameObject in the hierarchy view (not project view).

Chapter 5, Page 162

Credit: @omundy

In the Assembling Our Item section, third paragraph, rename the Scriptable Object, "Coin" (not "Item").

Chapter 5, Page 164

Credit: @omundy

In the Player Collisions section, the first line of code section // 3, should be:

print("Hit: " + hitObject.objectName);

Chapter 5, Page 166

Credit: @omundy

Steps 10 and 11 are duplicates of step 3 and can be disregarded.

Chapter 6, Page 198

Credit: @omundy

Under the heading Create the HealthBar Script, right-click in the MonoBehaviours folder and create a new C# script called HealthBar."

Chapter 6, Page 202-204

Credit: @omundy

Ensure a copy of the HealthBarObject is in the Hierarchy view and select it. Add the HealthBar script this HealthBarObject. When working with the HealthBar in these next 3 pages (202-204), work with the copy of HealthBarObject in the Hierarchy view, not the copy in the Prefab folder. Make sure to apply changes when you're done, so the changes propagate to the Prefab.

Note: The location of the button to apply changes to a prefab has changed in Unity 2018. The button is now located in the top right of the Inspector, in a drop-down menu called Overrides.

Chapter 6, Page 204

Credit: @omundy

The property, Character Category which appears in the source and in Figure 6-22 may be disregarded, or used later on in your game to broadly distinguish between what is/isn't an enemy, or the player (or even an NPC) instead of creating a tag for each character type.

Chapter 6, Page 207

Credit: @omundy

With InventoryObject selected, in the Canvas Scaler component, set Reference Pixels Per Unit to 32.

Chapter 7, Page 263

Credit: @omundy

In the The DamageCharacter() method section, the code should be added to the Enemy class.

Chapter 7, Page 269

Credit: @omundy

In the Refactoring Prefab Instantiation section, remove all four lines from Start() and add them to the new ResetCharacter() override.

After you add the ResetCharacter() method to the Player class, add the following method

private void OnEnable() {
	ResetCharacter();
}

Chapter 7, Page 275

Credit: @omundy

You'll notice when you run into the enemies they spin. Like you did with the PlayerObject, check Freeze Rotation for the Z axis inside the Rigidbody2D on the EnemyObject prefab.

Chapter 8, Page 287

Credit: @omundy

In the Enemy Walk Animation section, select the Enemy prefab then open the Animator window as seen in Figure 8-3.

devel-2d-games-unity's People

Contributors

jaredhalpern avatar jessicavakili avatar omundy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.