Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Procedural Content Generation for Unity Game Development

You're reading from   Procedural Content Generation for Unity Game Development Harness the power of procedural content generation to design unique games with Unity

Arrow left icon
Product type Paperback
Published in Jan 2016
Publisher
ISBN-13 9781785287473
Length 260 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ryan Watkins Ryan Watkins
Author Profile Icon Ryan Watkins
Ryan Watkins
Arrow right icon
View More author details
Toc

Scene setup

Now that we chose a data structure and designed our algorithm, we need to set up our scene. At the moment, at the start of our game, the player character shows up in the corner of the screen with a black backdrop. The player can move in four directions but could potentially move off screen. The player can also move under the text that shows the player's health. We should fix this so that we can better see our PCG algorithm in action.

Player positioning

Previously, we said that a starting grid of 5 x 5 for our initial Game Board would be a good metric. So let's continue with a 5 x 5 Game Board in mind. If our 5 x 5 grid starts with the X-Y coordinate or (0,0) in the lower-left corner and (4,4) in the upper-right corner, then (2,2) will be the center of the grid. Select the Player prefab in the Hierarchy panel and set both the X and Y values to 2.

Player positioning

The grid will correspond with the x-y plane

Each sprite in our sprite sheet is 32 x 32 pixels. When the sprite sheet was imported...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image