Presentation is loading. Please wait.

Presentation is loading. Please wait.

lecture 8 Our First Project

Similar presentations


Presentation on theme: "lecture 8 Our First Project"— Presentation transcript:

1 lecture 8 Our First Project 13.11.2017
These slides are designed for Game Design Class Science and Culture University By Alireza Seddighi.

2 Adding backgrounds Drag And Drop The Background Sprite From The Sprite Folder Set The Position To (0,0,0) Adjust Orders for sprite There Is Two Way To Set The Proper Order In Layer 1.increasing the z position of the layers 2. sorting layer 3. order in layer

3 increasing the z position of the layers

4 2.Sorting Layer From The Sprite Renderer Choose Sorting Layer
And Then Select Add Sorting Layer Click On The + Signe And add two new layers Background and Foreground

5 2.Sorting Layer Then select the background for the background sprite and select the foreground for the player sprite

6 3.Order in Layer Work exactly like sorting layer but it works for the specific layer or sprite The element in order 0 is going to render behind of the element in order 1 and so on Select the prefab for the player and set order in layer to 2 And select the clouds prefabs and set their order in layer to 1

7 Create other backgrounds
Create An Empty Object And Name It Background & set the position in 0,0,0 Drag the “game background” as the childe to background object Copy the “game background” and position it using snap tool (Hold V key)

8 Adding box collider to backgrounds
Select All The Backgrounds And From Add Component Search For “Box Collider 2d” What The Use Of Collider For Background ? In Order To Move Them We Should Detect Collision

9 Adding layer CLLICK ON THE LAYER SELECT ADD LAYER…
CREATE A LAYER CALLED “BG” SELECT ALL THE BACKGROUNDS AND SET THIRE LAYER TO BG

10 What’s the use of BG layer?
By Going To Edit > Project Setting > Physics 2d We Are Able To Turn Of Other Layer That we don’t need to BG to collide with

11 Bg Scaler Create A Folder In Scripts Folder With The Name Of Background Scripts Create New Script With The Name Of BGSclaler Select all the backgrounds and add BGSclaler component to them Open the BGSclaler script and delete Update function

12 What bgscaler is going to do ?
Is going to scale the backgrounds to fit the camera

13 cloud-collector Right Click On The Camera And Create An Empty Object Rename It To “Cloud Collectors” Then Right Click On The Cloud Collectors And Create 2 Empty Game Objects And Name Them “Cloud Collector” And “Cloud Spawner” Select “Cloud Collector” And “Cloud Spawner” and from add components add Box Collider 2D By selecting “Cloud Collector” And “Cloud Spawner” ,in the Box Collider 2D set x size to 10 and the y size to 0.1 Also set Is trigger checked

14 Tag the collector and spawner
By selecting “Cloud Collector” select a color for tagging the object Follow the same steps for “Cloud Spawner” Set the y position for “Cloud Collector” to 5.8 Set the y position for “Cloud Spawner” to -5.8

15 Cloud Collectors Scripts
Create Cloud Collectors Scripts folder Create CloudCollector scrip and CloudSpawner script Attach CloudCollector scrip to CloudCollector object And Attach CloudSpawner scrip to CloudSpawner object

16 CloudCollector scrip Create Cloud Collectors Scripts folder
For collision detection define the following function In order to define the tags “Cloud” and “Deadly” Select the cloud object and from inspector > tag > add tag > + sign > name the tag as “Cloud” and another tag called “Deadly” Select all the cloud prefab and change their tag to Cloud and select the Dark Cloud and set it’s tag to Deadly

17 CloudSpawner scrip In the CloudSpawner script define the following variables


Download ppt "lecture 8 Our First Project"

Similar presentations


Ads by Google