Download presentation
Presentation is loading. Please wait.
Published byWillis Hicks Modified over 9 years ago
1
Derived from Kirill Muzykov’s Rocket Mouse Tutorial http://www.raywenderlich.com/69392/make-game-like-jetpack-joyride-unity-2d-part-1 @shahedC WakeUpAndCode.com
2
Getting Started > Adding the Player > Adding Code > Ups & Downs Effects & Objects
5
… then, click “Create” Enter project location (empty folder) … Select 2D…
6
Verify 2D in Inspector Click Edit Project Settings Editor
7
Select “Main Camera” in hierarchy Verify Transform Position (0, 0, -10) Verify “Orthographic” Projection
8
In Project panel, right-click “Assets” folder Click Create, then Folder Name it “Scenes”
9
Click File Save Scene Name your scene, click Save Inside “Scenes” subfolder…
10
1.In the Game panel… 2.Click the list of dimensions 3.Click [+] to “Add New Item” 1 2 3 1.Label it “Landscape” 2.Width & Height = 1136 x 640 3.Click OK.
11
Select Main Camera in Hierarchy Update Size to 3.2
13
Drag to Assets
14
Audio and Sprites subfolders
15
Drag into Scene
16
Right-click “Fly” then click Rename Name it “Cat”
17
Select “Cat” in the Hierarchy In the Inspector panel, update Position: X = 0 Y = 0 Z = 0
18
Click “Add Component” Physics 2D Circle Collider 2D
19
In the Inspector panel, update Radius for Circle Collider 2D Radius = 0.5
20
Click “Add Component” Physics 2D Rigidbody 2D
21
In the Inspector panel, check “Fixed Angle”
22
The cat falls down! Run
24
Right-click Assets, click Create FolderName it “Scripts”
25
Right-click Scripts, click Create C# Script Name it “CatController”
26
Drag Script to Cat Verify Script Component
27
Click Edit Preferences Under External Tools, select your Script Editor e.g. MonoDevelop or Visual Studio Tip: Browse for devenv.exe in your Program Files folder if you don’t see Visual Studio
28
Double-Click Script Name
29
Script should launch in MonoDevelop or Visual Studio
30
Class Begins { } Class Ends
32
From top menu, click File Save Or, click Ctrl S on your keyboard.
33
Make the cat jump up as it falls! Run
35
Update Gravity X = 0 Y = -15 Click Edit Project Settings Physics 2D
36
Does the cat stay down with more force? Run
38
Click “Game Object” Create Empty Verify Game Object in Hierarchy
39
In Hierarchy tab, right-click empty Game Object click Rename name it “Floor”
40
With Floor selected in Hierarchy: Update Transform properties: Position: X = 0 Y = -3.5 Z = 0 Scale: X = 14.4 Y = 1 Z = 1
41
Click “Add Component” Physics 2D Box Collider 2D
42
Green Box Collider for Floor Floor is selected in Hierarchy
43
Click “Game Object” Create Empty Verify Game Object in Hierarchy
44
In Hierarchy tab, right-click empty Game Object click Rename name it “Ceiling”
45
With Floor selected in Hierarchy: Update Transform properties: Position: X = 0 Y = 3.7 Z = 0 Scale: X = 14.4 Y = 1 Z = 1
46
Click “Add Component” Physics 2D Box Collider 2D
47
Green Box Collider for Floor Both are selected in Hierarchy Green Box Collider for Ceiling
48
The cat should stop at the ceiling and floor! Run
50
Click “Game Object” Create Other Particle System
51
Verify Particle System in Hierarchy Verify Particle System in Scene
52
Verify Particle System is a child of Cat Drag Particle System to Cat in Hierarchy
53
Right-click “Particle System” then click Rename Name it “jetpackFlames”
54
In the Inspector panel for jetpackFlames, update: Transform: Position: X = -0.62 Y = -0.33 Z = 0 Rotation: X = 50 Y = 270 Z = 270 Particle System Start Lifetime = 0.5 Start Size = 0.3 Start Color: RGB = 255, 135, 40 Emission Rate = 300 Shape Shape = Cone Angle = 12 Radius = 0.1 Random Direction
55
1. Scroll down, then check “Color over Lifetime” 2. Click the color box 3. Select top-right slider 4. Set value to 0 (zero)
56
Drag Mountains into Scene
57
Drag Mountains into Scene Set Transform Position: X = 0 Y = 0 Z = 0
58
Click to Add Sorting Layer… Select Cat in Hierarchy
59
Add Layers for 1.Background 2.Decorations 3.Objects 4.Player Click + icon to add each new layer
60
Assign Sorting Layer Select Player
61
Assign Sorting Layer Select Background
62
Right-click Scripts, click Create C# Script Name it “ParticleSortingLayerFix”
63
Drag Script to jetpackFlames Verify Script Component
64
Double-Click Script Name
65
Start() Begins { } Start() Ends
66
Run
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.