Presentation is loading. Please wait.

Presentation is loading. Please wait.

Derived from Kirill Muzykov’s Rocket Mouse Tutorial WakeUpAndCode.com.

Similar presentations


Presentation on theme: "Derived from Kirill Muzykov’s Rocket Mouse Tutorial WakeUpAndCode.com."— Presentation transcript:

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

3 Select “Run” Sprite

4

5 (Sprite Editor pops up!)

6 1. Click Slice dropdown 2. Set Type to “Grid” 3. Set Pixel Size X = 156 Y = 156 4. Click Slice button

7 Click “Apply” then, close popup

8 Separate sprites for each frame

9

10 Click on Animation tab

11 Right-click Assets, click Create  FolderName it “Animations”

12 Select “Cat”

13 In Animation tab, Click dropdown… Create New Clip (twice) run fly

14 Save “run.anim“Save “fly.anim“

15 Verify: Cat animation fly clip run clip

16 Select “Cat” Verify “Animator”

17

18 Click “run” animation in dropdown

19 Expand “Run” animation in “Sprites” folder

20 Click first frame, press Shift on your keyboard, click last frame

21 Drag frames into “run” animation

22

23 Click “fly” animation in dropdown

24 Expand “Fly” animation in “Sprites” folder (notice that there’s only 1 frame)

25 Click Fly frame

26 Drag frame into “fly” animation

27 Click “red dot” recording icon to stop recording animations (or just Save)

28 The cat runs like crazy!!! Run

29

30 Update “Sample” to 8

31 Uncheck Apply Root Motion Change Update Mode to “Animate Physics”

32 The cat runs slower now, but is still running in the air! Run

33

34 Click on Animator tab

35 Right-click “run” animation, then click “Make Transition”

36 Click “fly” animation to finish creating the transition

37 Now, right-click “fly” animation, then click “Make Transition”

38 Click “run” animation to finish creating the transition

39 Click + next to Parameters (lower left of Animator tab) Choose “Bool” (which is of type Boolean) Name it “grounded”

40 Select run  fly animation Select “grounded” under Conditions Set to “false”

41 Select fly  run animation Select “grounded” under Conditions Set to “true”

42 Optional: Check/uncheck “grounded”, then play the game to test the animations Run

43

44 Verify new Game Object

45 Drag GameObject into “Cat”, verify that it is a child of “Cat”, rename to “GroundCheck”

46 Set Transform Position for “groundCheck” X = 0 Y = -0.7 Z = 0

47 Click icon symbol to select a color, e.g. green

48 Verify “groundCheck” game object

49 Expand “mount1” prefab, select “Floor”

50 In Inspector panel, click Layer dropdown to Add Layer…

51 Enter “Ground” for User Layer 8

52 Update Layer to “Ground”

53

54 Add 4 instance variables before Start() method

55 Add 1 line of code inside Start() method

56 Add new method UpdateGroundedStatus … just before class ends at the bottom

57 Add 1 line of code … just before FixedUpdate() ends

58 Select cat in Hierarchy Verify 2 new public items under Cat Controller script

59 With Cat selected… Drag “groundCheck” into Ground Check Transform

60 With Cat selected… set Ground Check Layer Mask to “Ground”

61

62

63 Add 1 line of code just before Start() method

64 Add new method AdjustJetpack() … just before class ends at the bottom

65 Add 1 line of code … just before FixedUpdate() ends

66 With Cat selected… drag “jetpackFlames” into Jetpack

67 Run The cat should run only while on the ground The jetpack particles should only be visible while in the air

68


Download ppt "Derived from Kirill Muzykov’s Rocket Mouse Tutorial WakeUpAndCode.com."

Similar presentations


Ads by Google