0% found this document useful (0 votes)
62 views9 pages

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

The document discusses setting up the first game "Roller Madness" in Unity to teach various game development concepts. It describes importing asset packages, designing levels with obstacles and floors, adding a character, implementing physics, programming health and damage, and creating pickups. The goal is for students to learn concepts like the asset pipeline, physics, animation and game play systems by developing this game.

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)
62 views9 pages

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

The document discusses setting up the first game "Roller Madness" in Unity to teach various game development concepts. It describes importing asset packages, designing levels with obstacles and floors, adding a character, implementing physics, programming health and damage, and creating pickups. The goal is for students to learn concepts like the asset pipeline, physics, animation and game play systems by developing this game.

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/ 9

2/22/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
2/22/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
2/22/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
2/22/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
2/22/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
2/22/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
2/22/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
• For the game over Under the hierarchy select UI – • It controls the states of game
Button • Three states Playing, Death, Game Over
▫ But it a little below score • Create an empty game object : Game Manager
▫ Change the color of the button to EEFFFB9B (origin)
• Copy values from the Score text to Button’s child Text • Add script and game manager
▫ Text should be Play Again ▫ Add player RollerBall
• Add Script UI Button Level Load ▫ Can bear level unchecked
▫ Level to load should be level 1 ▫ Select Main Canvas as your Main UI
▫ Go to button again and On Click option add plus ▫ Attach text where needed . Map them from Uis
 Drag the button text there
 From no function select the script added and select load level
▫ Add appropriate audio

7
2/22/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 • Add script of Health therefore it also dies
▫ Change it to orange albedo • Make enemy a prefab
▫ Apply it to enemy object
▫ Add two more enemies
• Add Script Chaser
▫ 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
▫ Start Lifetime 1 • Add script timeobject detructor
▫ Gravity 0.5 • Make Particle a Prefab
▫ Emission
 Rate =0 • Delete the game object
 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 RollerBal
• Change Material to RollerBall

8
2/22/2016

Particle System Particle System


• Duplicate the particle system and name it coin • Duplicate the particle system and name it enemy
particle system particle system
▫ Start size= .2 ▫ Start size= .2
▫ Particles = 10
▫ Particles = 10
• Renderer select cube
• Renderer select coin
• 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
▫ treasure script attached the particle system system

Questions

You might also like