0% found this document useful (0 votes)
80 views10 pages

Concepts To Learn: Lecture 3: Developing Our First Game - Roller Madness

The document discusses setting up a game called Roller Madness using Unity. It includes: - Importing standard Unity assets to use for the level design, including floors, obstacles and the player character. - Designing the base level with floors and placing obstacles like bumpers at different positions. - Adding scripts for player control, health tracking, damage detection and level loading. - Configuring physics properties and materials for interactions between the player and level elements. The goal is to learn game development concepts by building this prototype game using Unity's standard assets and scripts.

Uploaded by

Usama Sarfraz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views10 pages

Concepts To Learn: Lecture 3: Developing Our First Game - Roller Madness

The document discusses setting up a game called Roller Madness using Unity. It includes: - Importing standard Unity assets to use for the level design, including floors, obstacles and the player character. - Designing the base level with floors and placing obstacles like bumpers at different positions. - Adding scripts for player control, health tracking, damage detection and level loading. - Configuring physics properties and materials for interactions between the player and level elements. The goal is to learn game development concepts by building this prototype game using Unity's standard assets and scripts.

Uploaded by

Usama Sarfraz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

3/6/2016

Concepts to learn
• Asset Pipeline
• Standard Assets and Assets Packages
• More Editors Features
• Project Organization
Lecture 3: Developing our first game – Roller • Physics
Madness

“Game Development is Hard Fun”

Concepts to learn Roller Madness


• User Interface Basics • We will learn the concepts by making a game in unity
• Trial Renderers • First of all download the assets from VLE
• Particle System • In our first project we didn’t included standard assets
▫ Import standard assets like character
• Animation
▫ Cross Platform Input
• Game Play Systems ▫ Prototyping
▫ Utility

• It will take some time as it makes the copy of the


assets

1
3/6/2016

Roller Madness Setting up the scene : Base Level


• Import the assets you downloaded • We will design the base level with the standard unity
▫ Unity package assets
▫ We make package of our assets to share with others ▫ Standard Assets - Prototyping – Prefabs -
FloorPrototype64x01x64
• Import the sound assets you downloaded • Drag this in to your scene view
• Reset the Floor to origin
• Scale to (0.5, 1, 0.5)

Setting up the scene : Obstacles Setting up the scene : Obstacles


• We will design the obstacle with the standard unity • Now select the Bumper material and change its
assets texture through
▫ Standard Assets - Prototyping – Prefabs – ▫ Albedo map to SwatchTea
FloorPrototype04x01x04
• Rename it to Bumper • Now apply the Material to the Bumper Object
• As you can see that the Bumper has navygrid
material attached • Position the Bumper to (-2, 1, 0)
▫ Duplicate the navy blue material and name it bumper
material

2
3/6/2016

Prefabs Setting up the scene : Obstacles


• Unity has a Prefab asset type that allows you to store a • Create a prefab of the obstacle
GameObject object complete with components and
• Create a prefab of the floor as well
properties
• Create the copies of obstacles and drop them to
• The prefab acts as a template from which you can create scene
new object instances in the scene ▫ Copy 1 will be on (7,1,0)
▫ Copy 2 will be on (2, 1,8)
• Any edits made to a prefab asset are immediately ▫ Copy 3 will be on ( 2, 1, -8)
reflected in all instances produced from it but you can
also override components and settings for each instance
individually.

Setting up the scene : Characters Camera Settings


• Select the Standard Assets and select Roller Ball • Align the camera with the view
• Go to the prefab and get the RollerBall Prefab • In the standard assets
• Set the RollerBall to (0,2,0) ▫ Select utility
• Save the Scene ▫ And select smoothfollow script
• Drag and drop it in to the inspector of main camera
▫ Select the target to follow
▫ And distance to 6
• Add the solid color to skybox
• Add background music to camera

3
3/6/2016

Project Organization Physics


• Organize all your game objects in the folder • Two physics engines
▫ 3D Physics = PhysX Engine
• Most of the time its useful to create empty objects ▫ 2D Physics = Box2D Engine
to organize the game objects • RollerBall has a sphere collider attached
• Similarly, Bumper has a box collider attached
• Trigger allows us with extra options

Physics: Rigidbody Physics: Kinematic


• A Rigidbody is the main component that enables • Is Kinematic If enabled, the object will not be driven
physical behaviour for an object by the physics engine, and can only be manipulated
by its Transform
• With a Rigidbody attached, the object will
immediately respond to gravity • This is useful for moving platforms or if you want to
animate a Rigidbody that has a HingeJoint attached
• If one or more Collider components are also added
then the object will be moved by incoming collisions

4
3/6/2016

Physics: Material Player Control and Appearances


• You would notice that RollerBall has a rubber • Lets tweak some player control settings
material
• You can attach material to Bumpers as well • In the ball script make
▫ Attach Bounce Material to Bumpers ▫ Jump Power to 0 and
▫ You can select it from the Box colliders ▫ Move Power to 100
• Now select the material that is applied to RollerBall
and Duplicate that
▫ I want my own setting for that material (00ffeaff)
▫ Apply the material to the RollerBall

Player Control and Appearances Health and Damage


• Select RollerBall and • Add script to RollerBall – Health
▫ Add Effects and Trail Renderer ▫ That is used to track health in game
• Create new material for trail ▫ Tweak the options for on lives gone to : load level
▫ Change Shader from Standard to Particle –Alpha  Make sure to change it to default if you include game
Blended manager
▫ Select color to white ▫ Specify the name of level for example Level 1
• Apply material to RollerBall Trail effect
• Some other settings
▫ Time =2 Start Width = 0.8 End Width = 0 and Colors
to 00ffeaff ( make them a little transparent)

5
3/6/2016

Health and Damage Health and Damage


• To detect damage we need something that Rollerball can • Now , select the
hit ▫ Damage script and apply it to deathzone
▫ So we duplicate the floor and rename it to death zone
▫ Make a Prefab of death zone
▫ Make the box collider of damage script to is trigger
▫ Death zone position (0, -2, 0 )
▫ Scale should be (2, 1 ,2 )
• Also create a new material for deathzone
▫ Select the material of deathzone i.e. Navygrid
▫ Duplicate it and name it deathgrid
▫ Apply it to deathzone
▫ Change color to make it more visible

Pickups Pickups
• Go to prototyping standard assets • Now we can add some points for coin
▫ Select models – PickupPrototyping 01 *01 * 01 ▫ Add Treasure script
▫ Drag it to scene and name it coin • You can see that Rollerball has a Tag of Player
▫ Position (0,1,0) scale (.4,.4,.4) ▫ A Tag is a word which you link to one or more GameObjects.
▫ Change material to something like yellow (Note : you
can make new material ) • Lets make a new tag (pickup) and attached this tag to
▫ Add a new component from physics- Sphere collider coin
▫ Make it a rigid body (is kinematic with no gravity) • Make coin a prefab as we want multiple copies of it
▫ Add from scripts the Rotate script • Through some coins in the scene
 Speed (180)

6
3/6/2016

UI Basics UI Basics
• Under the hierarchy select UI – Text • For the game over Under the hierarchy select UI –
• In Canvas Scalar Script attached (Canvas) Text
▫ Make it scale with Screen Size • In Canvas Scalar Script attached (Canvas)
• Now select the text as we want it at the top Press F and ▫ Make it scale with Screen Size
also go in to 2D mode • Copy values from the Score text to GameOver Text
• From the Anchor Presets Select Top ▫ It should be in the middle
• From the Text you can write text and can change fonts ▫ Font should be 100 (a little big)
• From the Paragraph ▫ Set it in middle
▫ Select overflow from both Horizontal and Vertical
▫ Select font color to EEFFFB9B

UI Basics Game Manager


• We also need a button for play again
▫ This will be a child of Game Over text • It controls the states of game
• For the game over Under the hierarchy select UI – • Three states Playing, Death, Game Over
Button • Create an empty game object : Game Manager (origin)
▫ But it a little below score • Add script to game manager named Game Manager
▫ Change the color of the button to EEFFFB9B ▫ Add player RollerBall
• Copy values from the Score text to Button’s child Text ▫ Can bear level unchecked
▫ Text should be Play Again ▫ Select Main Canvas as your Main UI
• Add Script UI Button Level Load to the text ▫ Attach text where needed . Map them from Uis
▫ Level to load should be level 1 ▫ Add appropriate audio i.e. Main Camera and Game Over
▫ Go to button again and On Click option add plus ▫ On the health script of RollerBall select on levels gone :
 Drag the button text there nothing
 From no function select the script added and select load level

7
3/6/2016

Enemies Enemies
• Create a new 3D object cube and place it to origin (0,1,0) • We need to add a script Damage
• Create a new material for the enemy name it enemy ▫ Select damage on collision
material ▫ Uncheck damage on Trigger
▫ Change it to orange albedo • Add script of Health therefore it also dies
▫ Apply it to enemy object
• Make enemy a prefab
• Add Script Chaser
▫ Add two more enemies
▫ select speed to 4 and distance 0 and target RollerBall
• Make it away from the player
• Make it rigid body
• Box Collider physical material should be bouncy

Particle System Particle System


• Create a new particular system from hierarchy • Add audio source to your particle
▫ Name it explode particles
• Tweak with some properties ▫ Explosion audio
▫ Duration 1 • Add script timeobjectDetructor
▫ Start Lifetime 1
▫ Gravity 0.5 • Make Particle a Prefab
▫ Emission • Delete the game object
 Rate =0
 Burst =20 particles • Go to RollerBall game object and in Health click
• Shape property to Hamisphere explosion prefab attached the particle system
• Size of lifetime checked
• Change Renderer to Mesh and select RollerBal
• Change Material to RollerBall

8
3/6/2016

Particle System Particle System


• Duplicate the particle system prefab and name it • Duplicate the particle system prefab and name it enemy
coin particle system particle system
▫ Start size= .2 ▫ Start size= .2
▫ Particles = 10 ▫ Particles = 10
• Renderer select coin • Renderer select cube
• Change Material to enemy
• Change Material to coin
• Enemy explosion sound effect
• Coin explosion sound effect
• In Enemy game object
• In Coin game object ▫ Damage script and Health attached the particle system
▫ treasure script attached the particle system  Check Destroy self on impact in damage script

Animation Spawners
• Adds visual polish to games • Create a new empty game object Enemyspawner
• Select the death zone you created • Add script spawn game objects
• From Windows select a new animation system ▫ Attach spawn prefab enemy
▫ Create a new animation name it deathzone animation ▫ Chase Target to RollerBall
▫ For different key frames record different albedo maps • Make EnemySpawner a prefab
▫ Make there height above 9 i.e. the spawn from above
▫ Put them in corners

9
3/6/2016

Spawners Spawners
• Duplicate the prefab for coin and name it bouncyCoin • Remove the GameObject BouncyCoin from world
• Attach gravity to it and uncheck is Kinematic • Add script spawn game objects
• Add another collider ▫ Attach spawn prefab Bouncycoin
▫ Pick Box Collider
▫ Make it bouncy
• Remove Rotate component
• Copy Trial Renderer from RollerBall
▫ Change Color to yellow
• Add TimeObjectDestructor script
▫ Time Out 10

Questions

10

You might also like