intro to construct 2: ghost shooter - step by step

284
By Shahed Chowdhuri Sr. Technical Evangelist Intro to Construct 2 Game Development Windows 8 Windows Phone 8 Web Mobile … and more! @shahedC WakeUpAndCode.com

Upload: shahed-chowdhuri

Post on 18-Jun-2015

2.903 views

Category:

Technology


4 download

DESCRIPTION

Derived from Beginner’s Guide to Construct 2 originally published by Ashley, it expands upon the written tutorial by providing detailed screenshots of every step and is grouped into concepts that I identified from my learning. Also, the steps and screenshots from a recent version (as of 2014). Finally, it explains relevant concepts such as Parallax and X-Y Coordinates for Graphics Programming. * Original Tutorial: https://www.scirra.com/tutorials/37/beginners-guide-to-construct-2 * Ashley from Scirra: https://www.scirra.com/users/ashley

TRANSCRIPT

Page 1: Intro to Construct 2: Ghost Shooter - Step by Step

By Shahed ChowdhuriSr. Technical Evangelist

Intro to Construct 2 Game DevelopmentWindows 8 Windows Phone 8 Web Mobile … and more!

@shahedC

WakeUpAndCode.com

Page 2: Intro to Construct 2: Ghost Shooter - Step by Step

Agenda

Intro

> Construct 2 Basics> Characters and Objects> Bringing It All Together

Wrap-Up

Page 3: Intro to Construct 2: Ghost Shooter - Step by Step

My BackgroundPeriod Background/Experience

1997 – present

Microsoft web/software development

2011 XNA games on XBLIG• 2D Math Panic• Angry Zombie Ninja Cats

2012 Tools for XNA developers• XBLIG Sales Data Analyzer (OnekSoftLabs.com)• XNA Basic Starter Kit (CodePlex)

Online: http://facebook.com/OnekSoftGames

Page 4: Intro to Construct 2: Ghost Shooter - Step by Step

My Background (continued)Period Background/Experience

2013 • Ninja Cat Runner on Win8, WP8, Web (Construct2)• Video Q&A with MS Tech Evangelist Frank La Vigne• Founder/Admin of FB groups: Construct 2, Xbox One & Unity Indie

Devs• Attended ID@Seattle, Microsoft’s ID@Xbox summit

2014 • Public Speaking on Indie Game Development• Joined Microsoft as a Technical Evangelist• Attended ID@Chicago

Video: http://youtu.be/lRjrQPvVOpo

Page 5: Intro to Construct 2: Ghost Shooter - Step by Step

Official Xbox Magazine

Source: Official Xbox Magazine, March 2014, Page 65

`

Page 6: Intro to Construct 2: Ghost Shooter - Step by Step

Tools & Technologies

Tip: Get free dev software via BizSpark!http://aka.ms/dcmeetup201406 http://aka.ms/PhillyBizSpark

Page 7: Intro to Construct 2: Ghost Shooter - Step by Step

Construct 2

Source: https://www.scirra.com/construct2

Page 8: Intro to Construct 2: Ghost Shooter - Step by Step

How This Presentation Was Put Together

Derived from Beginner's Guide to Construct 2 originally published by Ashley

Concepts

Steps

Step-by-Step

Screenshots, Grouped

into Concepts

Get pptx file and images from: http://WakeUpAndCode.com/downloads

Page 9: Intro to Construct 2: Ghost Shooter - Step by Step

1. Going Multiplatform2. Tiled Backgrounds3. Layers and Locks4. Mouse and Keyboard

Support5. Sprites and Game

Characters6. Adding NPCs7. Other Game Objects8. Organizing Your Layout9. Moving the Player10. Adding Behaviors11. Moving NPCs12. Accepting User Input13. Spawning Other Objects

Construct 2 Concepts14. Image Points15. Collision Detection16. Basic AI 17. Improved AI18. Instance Variables19. Affecting NPC Health20. Global Variables21. Adding a HUD22. Displaying Text23. Updating the HUD24. Spawning NPCs25. Destroying the Player

Page 10: Intro to Construct 2: Ghost Shooter - Step by Step
Page 11: Intro to Construct 2: Ghost Shooter - Step by Step

Construct 2 Basics

Page 12: Intro to Construct 2: Ghost Shooter - Step by Step

Getting Started: Step 1

• https://www.scirra.com/ Download!

Page 13: Intro to Construct 2: Ghost Shooter - Step by Step

Getting Started: Step 2

Run it!

Page 14: Intro to Construct 2: Ghost Shooter - Step by Step

Getting Started: Step 3

ClickFile New

Page 15: Intro to Construct 2: Ghost Shooter - Step by Step

Getting Started: Step 4

Filter

ScrollUpOrDown

Open!

Page 16: Intro to Construct 2: Ghost Shooter - Step by Step

Getting Started: Step 5Toolbar Projects/Layers

ObjectsLayoutProperties

Tabs for Layouts & Event Sheets

Page 17: Intro to Construct 2: Ghost Shooter - Step by Step

Getting Started: Step 6

ClickFile Save

Page 18: Intro to Construct 2: Ghost Shooter - Step by Step

Getting Started: Step 7

Save!

EnterFile name

Page 19: Intro to Construct 2: Ghost Shooter - Step by Step

Getting Started: Done!

Page 20: Intro to Construct 2: Ghost Shooter - Step by Step

1. Going Multiplatform

Page 21: Intro to Construct 2: Ghost Shooter - Step by Step

Export Project: Step 1

ClickFile Export project…

Page 22: Intro to Construct 2: Ghost Shooter - Step by Step

• Choose a platform…

Export Project: Step 2

Page 23: Intro to Construct 2: Ghost Shooter - Step by Step

Export Project: Step 3• Publish anywhere…

Page 24: Intro to Construct 2: Ghost Shooter - Step by Step

2. Tiled Backgrounds

Page 25: Intro to Construct 2: Ghost Shooter - Step by Step

Add a Tiled Background: Step 1

Right-ClickInside Layout

Page 26: Intro to Construct 2: Ghost Shooter - Step by Step

Add a Tiled Background: Step 2

Select“Tiled Background”

then

Click Insert

Page 27: Intro to Construct 2: Ghost Shooter - Step by Step

Add a Tiled Background: Step 3

Click inside Layout

Page 28: Intro to Construct 2: Ghost Shooter - Step by Step

Add a Tiled Background: Step 4

ClickOpenicon

to load an image

Page 29: Intro to Construct 2: Ghost Shooter - Step by Step

Add a Tiled Background: Step 5

Select bg.png from theimages folder

NOTE: this may look different on your computer

Open!

Page 30: Intro to Construct 2: Ghost Shooter - Step by Step

Add a Tiled Background: Step 6

Close thispopup window

Page 31: Intro to Construct 2: Ghost Shooter - Step by Step

Add a Tiled Background: Step 7

Notice the extra space?

Page 32: Intro to Construct 2: Ghost Shooter - Step by Step

BUT FIRST… KNOW YOUR X and Y!

Graphs in Math class Graphs in Computer Graphics

Page 33: Intro to Construct 2: Ghost Shooter - Step by Step

Add a Tiled Background: Step 8

Update:

Position: • X = 0• Y = 0

Size:• Width = 1280• Height = 1024

Page 34: Intro to Construct 2: Ghost Shooter - Step by Step

Add a Tiled Background: Step 9

Update:

Size:• Width = 1280• Height = 1024

Select Layout 1

Page 35: Intro to Construct 2: Ghost Shooter - Step by Step

Add a Tiled Background: Step 10

Zoom Out:

• Ctrl + Scroll

Page 36: Intro to Construct 2: Ghost Shooter - Step by Step

Add a Tiled Background: Step 11

Zoom To 100%:

• Ctrl + 0 (zero)

Page 37: Intro to Construct 2: Ghost Shooter - Step by Step

Add a Tiled Background: Done!

Page 38: Intro to Construct 2: Ghost Shooter - Step by Step

3.Layers and Locks

Page 39: Intro to Construct 2: Ghost Shooter - Step by Step

Add Layers: Step 1

Click the Layers tab

Page 40: Intro to Construct 2: Ghost Shooter - Step by Step

Add Layers: Step 2

Click the Edit icon(pencil)

to rename Layer 0

Page 41: Intro to Construct 2: Ghost Shooter - Step by Step

Add Layers: Step 3

Enter“Background”

Page 42: Intro to Construct 2: Ghost Shooter - Step by Step

Add Layers: Step 4

Lock it!(lock symbol)

Page 43: Intro to Construct 2: Ghost Shooter - Step by Step

Add Layers: Step 5

Add a new layer(plus sign)

Page 44: Intro to Construct 2: Ghost Shooter - Step by Step

Add Layers: Step 6

Click the Edit icon(pencil)

to rename

new layer

Page 45: Intro to Construct 2: Ghost Shooter - Step by Step

Add Layers: Step 7

Enter“Main”

Page 46: Intro to Construct 2: Ghost Shooter - Step by Step

Add Layers: Done!

Page 47: Intro to Construct 2: Ghost Shooter - Step by Step

4. Mouse and Keyboard Support

Page 48: Intro to Construct 2: Ghost Shooter - Step by Step

Add Hidden Objects: Step 1

Make sureMain layeris selected

Page 49: Intro to Construct 2: Ghost Shooter - Step by Step

Add Hidden Objects: Step 2

Right-click to insert new object

Page 50: Intro to Construct 2: Ghost Shooter - Step by Step

Add Hidden Objects: Step 3

Select“Mouse”

then

Click Insert

Page 51: Intro to Construct 2: Ghost Shooter - Step by Step

Add Hidden Objects: Step 4

Right-click *again* to insert another object

Page 52: Intro to Construct 2: Ghost Shooter - Step by Step

Add Hidden Objects: Step 5

Select“Keyboard”

then

Click Insert

Page 53: Intro to Construct 2: Ghost Shooter - Step by Step

Add Hidden Objects: Done!

Noticeboth

Keyboardand

Mousehere

Page 54: Intro to Construct 2: Ghost Shooter - Step by Step

5. Sprites and Game Characters

Page 55: Intro to Construct 2: Ghost Shooter - Step by Step

Add Player to Game: Step 1

Right-click to insert new object

Page 56: Intro to Construct 2: Ghost Shooter - Step by Step

Add Player to Game: Step 2

Select“Sprite”

then

Click Insert

Page 57: Intro to Construct 2: Ghost Shooter - Step by Step

Add Player to Game: Step 3

Click inside Layout

Page 58: Intro to Construct 2: Ghost Shooter - Step by Step

Add Player to Game: Step 4

ClickOpenicon

to load an image

Page 59: Intro to Construct 2: Ghost Shooter - Step by Step

Add Player to Game: Step 5

Select player.png

from theimages folder

NOTE: this may look different on your computerOpen!

Page 60: Intro to Construct 2: Ghost Shooter - Step by Step

Add Player to Game: Step 6

Close thispopup window

Page 61: Intro to Construct 2: Ghost Shooter - Step by Step

Add Player to Game: Done!

Page 62: Intro to Construct 2: Ghost Shooter - Step by Step

6. Adding NPCsi.e. non-playable characters

Page 63: Intro to Construct 2: Ghost Shooter - Step by Step

Add Monster to Game: Step 1

Right-click to insert new object

Page 64: Intro to Construct 2: Ghost Shooter - Step by Step

Add Monster to Game: Step 2

Select“Sprite”

then

Click Insert

Page 65: Intro to Construct 2: Ghost Shooter - Step by Step

Add Monster to Game: Step 3

Click inside Layout

Page 66: Intro to Construct 2: Ghost Shooter - Step by Step

Add Monster to Game: Step 4

ClickOpenicon

to load an image

Page 67: Intro to Construct 2: Ghost Shooter - Step by Step

Add Monster to Game: Step 5

Select monster.png

from theimages folder

NOTE: this may look different on your computerOpen!

Page 68: Intro to Construct 2: Ghost Shooter - Step by Step

Add Monster to Game: Step 6

Close thispopup window

Page 69: Intro to Construct 2: Ghost Shooter - Step by Step

Add Monster to Game: Done!

Page 70: Intro to Construct 2: Ghost Shooter - Step by Step

7. Other Game Objectse.g. bullets and explosions

Page 71: Intro to Construct 2: Ghost Shooter - Step by Step

Add Objects to Game: Step 1

Right-click to insert new object

Page 72: Intro to Construct 2: Ghost Shooter - Step by Step

Add Objects to Game: Step 2

Select“Sprite”

then

Click Insert

Page 73: Intro to Construct 2: Ghost Shooter - Step by Step

Add Objects to Game: Step 3

Click inside Layout

Page 74: Intro to Construct 2: Ghost Shooter - Step by Step

Add Objects to Game: Step 4

ClickOpenicon

to load an image

Page 75: Intro to Construct 2: Ghost Shooter - Step by Step

Add Objects to Game: Step 5

Select bullet.png from the

images folder

NOTE: this may look different on your computerOpen!

Page 76: Intro to Construct 2: Ghost Shooter - Step by Step

Add Objects to Game: Step 6

Close thispopup window

Page 77: Intro to Construct 2: Ghost Shooter - Step by Step

Add Objects to Game: Step 7

Right-click to insert new object

Page 78: Intro to Construct 2: Ghost Shooter - Step by Step

Add Objects to Game: Step 8

Select“Sprite”

then

Click Insert

Page 79: Intro to Construct 2: Ghost Shooter - Step by Step

Add Objects to Game: Step 9

Click inside Layout

Page 80: Intro to Construct 2: Ghost Shooter - Step by Step

Add Objects to Game: Step 10

ClickOpenicon

to load an image

Page 81: Intro to Construct 2: Ghost Shooter - Step by Step

Add Objects to Game: Step 11

Select explode.png

from theimages folder

NOTE: this may look different on your computerOpen!

Page 82: Intro to Construct 2: Ghost Shooter - Step by Step

Add Objects to Game: Step 12

Close thispopup window

Page 83: Intro to Construct 2: Ghost Shooter - Step by Step

Add Objects to Game: Done!

Page 84: Intro to Construct 2: Ghost Shooter - Step by Step

8. Organizing Your Layout

Page 85: Intro to Construct 2: Ghost Shooter - Step by Step

Organize Your Layout: Step 1

Right-click to Rename

each sprite

Page 86: Intro to Construct 2: Ghost Shooter - Step by Step

Organize Your Layout: Step 2

Name them:• Player• Monster• Bullet• Explosion

Page 87: Intro to Construct 2: Ghost Shooter - Step by Step

Bonus Step: Update Blend Mode

Change Blend Modeto Additive

Page 88: Intro to Construct 2: Ghost Shooter - Step by Step

Organize Your Layout: Step 3

Zoom Out:

• Ctrl + Scroll

Page 89: Intro to Construct 2: Ghost Shooter - Step by Step

Organize Your Layout: Step 4

Move thebullet andexplosion

outside theLayout

Page 90: Intro to Construct 2: Ghost Shooter - Step by Step

Organize Your Layout: Done!

Page 91: Intro to Construct 2: Ghost Shooter - Step by Step

9. Moving the Player

Page 92: Intro to Construct 2: Ghost Shooter - Step by Step

Move The Player: Step 1

Select Player

Page 93: Intro to Construct 2: Ghost Shooter - Step by Step

Move The Player: Step 2

Click

Page 94: Intro to Construct 2: Ghost Shooter - Step by Step

Move The Player: Step 3

Click Add New(plus sign)

Page 95: Intro to Construct 2: Ghost Shooter - Step by Step

BUT FIRST… KNOW YOUR MOVEMENTS!

ScrollUpOrDown

Page 96: Intro to Construct 2: Ghost Shooter - Step by Step

Move The Player: Step 4

Select“8 Direction”

then

Click Add

Page 97: Intro to Construct 2: Ghost Shooter - Step by Step

Move The Player: Step 5

Click Again

Page 98: Intro to Construct 2: Ghost Shooter - Step by Step

Move The Player: Step 6

Click Add New(plus sign) again

Page 99: Intro to Construct 2: Ghost Shooter - Step by Step

Move The Player: Step 7

Select“Scroll To”

then

Click Add

Page 100: Intro to Construct 2: Ghost Shooter - Step by Step

Move The Player: Step 8

Click Add New(plus sign) again

Page 101: Intro to Construct 2: Ghost Shooter - Step by Step

Move The Player: Step 9

Select“Bound Tolayout”

then

Click Add

Page 102: Intro to Construct 2: Ghost Shooter - Step by Step

Move The Player: Step 10

Closepopup

Page 103: Intro to Construct 2: Ghost Shooter - Step by Step

Move The Player: Done!

Page 104: Intro to Construct 2: Ghost Shooter - Step by Step

10. Adding Behaviors

Page 105: Intro to Construct 2: Ghost Shooter - Step by Step

Add Behaviors: Step 1

Select Bullet

Page 106: Intro to Construct 2: Ghost Shooter - Step by Step

Add Behaviors: Step 2

Click

Page 107: Intro to Construct 2: Ghost Shooter - Step by Step

Add Behaviors: Step 3

Click Add New(plus sign)

Page 108: Intro to Construct 2: Ghost Shooter - Step by Step

Add Behaviors: Step 4

Select“Bullet”

then

Click Add

Page 109: Intro to Construct 2: Ghost Shooter - Step by Step

Add Behaviors: Step 5

Click Add New(plus sign) again

Page 110: Intro to Construct 2: Ghost Shooter - Step by Step

Add Behaviors: Step 6

Select“Destroyoutside layout”

then

Click Add

Page 111: Intro to Construct 2: Ghost Shooter - Step by Step

Add Behaviors: Step 7

Closepopup

Page 112: Intro to Construct 2: Ghost Shooter - Step by Step

Add Behaviors: Step 8

Select Explosion

Page 113: Intro to Construct 2: Ghost Shooter - Step by Step

Add Behaviors: Step 9

Click

Page 114: Intro to Construct 2: Ghost Shooter - Step by Step

Add Behaviors: Step 10

Click Add New(plus sign)

Page 115: Intro to Construct 2: Ghost Shooter - Step by Step

Add Behaviors: Step 11

Select“Fade”

then

Click Add

Page 116: Intro to Construct 2: Ghost Shooter - Step by Step

Add Behaviors: Step 12

Closepopup

Page 117: Intro to Construct 2: Ghost Shooter - Step by Step

Add Behaviors: Step 13

Update BulletSpeed = 600

Update ExplosionFade out time = 0.5

Page 118: Intro to Construct 2: Ghost Shooter - Step by Step

Add Behaviors: Done!

Page 119: Intro to Construct 2: Ghost Shooter - Step by Step

11. Moving NPCsi.e. non-playable characters

Page 120: Intro to Construct 2: Ghost Shooter - Step by Step

Move Monsters: Step 1

Select Monster

Page 121: Intro to Construct 2: Ghost Shooter - Step by Step

Move Monsters: Step 2

Click

Page 122: Intro to Construct 2: Ghost Shooter - Step by Step

Move Monsters: Step 3

Click Add New(plus sign)

Page 123: Intro to Construct 2: Ghost Shooter - Step by Step

Move Monsters: Step 4

Select“Bullet”

then

Click Add

Page 124: Intro to Construct 2: Ghost Shooter - Step by Step

Move Monsters: Step 5

Closepopup

Page 125: Intro to Construct 2: Ghost Shooter - Step by Step

Move Monsters: Step 6

Update Monster’s Bullet BehaviorSpeed = 80

Page 126: Intro to Construct 2: Ghost Shooter - Step by Step

Move Monsters: Step 7

Select Monster

Ctrl-Click and Dragto create more!

Page 127: Intro to Construct 2: Ghost Shooter - Step by Step

Move Monsters: Done!

Page 128: Intro to Construct 2: Ghost Shooter - Step by Step

12. Accepting User Input

Page 129: Intro to Construct 2: Ghost Shooter - Step by Step

Add Mouse Event: Step 1

Add events to theEvent Sheet

Page 130: Intro to Construct 2: Ghost Shooter - Step by Step

BUT FIRST… KNOW ABOUT EVENTS!

ObjectCondition

Event

An “Event” happens

when a Condition is True

for an Object

Page 131: Intro to Construct 2: Ghost Shooter - Step by Step

Add Mouse Event: Step 2

Right-Click, then Add

Event

Page 132: Intro to Construct 2: Ghost Shooter - Step by Step

Add Mouse Event: Step 3

Select “System”

then

Next!

Page 133: Intro to Construct 2: Ghost Shooter - Step by Step

Add Mouse Event: Step 4

Select “Every tick”

then

Done!

Page 134: Intro to Construct 2: Ghost Shooter - Step by Step

Add Mouse Event: Step 5

Click to Add Action

Page 135: Intro to Construct 2: Ghost Shooter - Step by Step

Add Mouse Event: Step 6

Select “Player”

then

Next!

Page 136: Intro to Construct 2: Ghost Shooter - Step by Step

Add Mouse Event: Step 7

Select “Set angle toward position”then

Next!

Page 137: Intro to Construct 2: Ghost Shooter - Step by Step

Add Mouse Event: Step 8

Enter Parameters• X = Mouse.X• Y = Mouse.Y

Done!

Page 138: Intro to Construct 2: Ghost Shooter - Step by Step

Add Mouse Event: Done!

Page 139: Intro to Construct 2: Ghost Shooter - Step by Step

13. Spawning Other Objectse.g. Bullets

Page 140: Intro to Construct 2: Ghost Shooter - Step by Step

Shoot Bullets: Step 1

Click to Add Event

Page 141: Intro to Construct 2: Ghost Shooter - Step by Step

Shoot Bullets: Step 2

Select “Mouse”

then

Next!

Page 142: Intro to Construct 2: Ghost Shooter - Step by Step

Shoot Bullets: Step 3

Select “On click”

then

Next!

Page 143: Intro to Construct 2: Ghost Shooter - Step by Step

Shoot Bullets: Step 4

Done!

Page 144: Intro to Construct 2: Ghost Shooter - Step by Step

Shoot Bullets: Step 5

Click to Add Action

Page 145: Intro to Construct 2: Ghost Shooter - Step by Step

Shoot Bullets: Step 6

Select “Player”

then

Next!

Page 146: Intro to Construct 2: Ghost Shooter - Step by Step

Shoot Bullets: Step 7

Select “Spawn another object”then

Next!

Page 147: Intro to Construct 2: Ghost Shooter - Step by Step

Shoot Bullets: Step 8

Click to Choose

Page 148: Intro to Construct 2: Ghost Shooter - Step by Step

Shoot Bullets: Step 9

Select “Bullet”

then

OK!

Page 149: Intro to Construct 2: Ghost Shooter - Step by Step

Shoot Bullets: Step 10

Done!

Enter• Layer = 1• Image point = 0

Page 150: Intro to Construct 2: Ghost Shooter - Step by Step

Shoot Bullets: Done!

Page 151: Intro to Construct 2: Ghost Shooter - Step by Step

14. Image Points

Page 152: Intro to Construct 2: Ghost Shooter - Step by Step

Fix Bullets: Step 1

Right-ClickPlayerthenEdit animations

Page 153: Intro to Construct 2: Ghost Shooter - Step by Step

Fix Bullets: Step 2

Click to Set origin and image

points

Page 154: Intro to Construct 2: Ghost Shooter - Step by Step

Fix Bullets: Step 3

Click to add

Page 155: Intro to Construct 2: Ghost Shooter - Step by Step

Fix Bullets: Step 4

Click infront of gun

Then, close popup

Page 156: Intro to Construct 2: Ghost Shooter - Step by Step

Fix Bullets: Step 5

Right-ClickSpawnthenClick Edit

Page 157: Intro to Construct 2: Ghost Shooter - Step by Step

Fix Bullets: Step 6

Done!

Update• Image point = 1

Page 158: Intro to Construct 2: Ghost Shooter - Step by Step

15. Collision Detection

Page 159: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 1

Click to Add Event

Page 160: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 2

Select “Bullet”

then

Next!

Page 161: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 3

Select “On collision with another object”then

Next!

Page 162: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 4

Click to choose

Page 163: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 5

Select “Monster”

then

OK!

Page 164: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 6

Done!

Page 165: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 7

Click to Add Action

Page 166: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 8

Select “Monster”

then

Next!

Page 167: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 9

Select “Destroy”then

Done!

Page 168: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 10

Click to Add Action

Page 169: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 11

Select “Bullet”

then

Next!

Page 170: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 12

Select “Spawn another object”then

Next!

Page 171: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 13

Click to Choose

Page 172: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 14

Select “Explosion”

then

OK!

Page 173: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 15

Done!

Enter• Layer = 1• Image point = 0

Page 174: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 16

Click to Add Action

Page 175: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 17

Select “Bullet”

then

Next!

Page 176: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 18

Select “Destroy”then

Done!

Page 177: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Done!

Page 178: Intro to Construct 2: Ghost Shooter - Step by Step

16. Basic AI e.g. enemy placement

Page 179: Intro to Construct 2: Ghost Shooter - Step by Step

Randomize Monsters: Step 1

Go to yourEvent Sheet

Page 180: Intro to Construct 2: Ghost Shooter - Step by Step

Randomize Monsters: Step 1

Click to Add Event

Page 181: Intro to Construct 2: Ghost Shooter - Step by Step

Randomize Monsters: Step 3

Select “System”

then

Next!

Page 182: Intro to Construct 2: Ghost Shooter - Step by Step

Randomize Monsters: Step 4

Select “On start of layout”

then

Done!

Page 183: Intro to Construct 2: Ghost Shooter - Step by Step

Randomize Monsters: Step 5

Click to Add Action

Page 184: Intro to Construct 2: Ghost Shooter - Step by Step

Randomize Monsters: Step 6

Select “Monster”

then

Next!

Page 185: Intro to Construct 2: Ghost Shooter - Step by Step

Randomize Monsters: Step 7

Select “Set angle”then

Next!

Page 186: Intro to Construct 2: Ghost Shooter - Step by Step

Randomize Monsters: Step 8

Enter Angle• random(360)

Done!

Page 187: Intro to Construct 2: Ghost Shooter - Step by Step

Randomize Monsters: Done!

x

Page 188: Intro to Construct 2: Ghost Shooter - Step by Step

17. Improved AI e.g. follow the player

Page 189: Intro to Construct 2: Ghost Shooter - Step by Step

Improve Monsters: Step 1

Go to yourEvent Sheet

Page 190: Intro to Construct 2: Ghost Shooter - Step by Step

Improve Monsters: Step 2

Click to Add Event

Page 191: Intro to Construct 2: Ghost Shooter - Step by Step

Improve Monsters: Step 3

Select “Monster”

then

Next!

Page 192: Intro to Construct 2: Ghost Shooter - Step by Step

Improve Monsters: Step 4

Select “Is outside

layout”then

Done!

Page 193: Intro to Construct 2: Ghost Shooter - Step by Step

Improve Monsters: Step 5

Click to Add Action

Page 194: Intro to Construct 2: Ghost Shooter - Step by Step

Improve Monsters: Step 6

Select “Monster”

then

Next!

Page 195: Intro to Construct 2: Ghost Shooter - Step by Step

Improve Monsters: Step 7

Select “Set angletowards position”then

Next!

Page 196: Intro to Construct 2: Ghost Shooter - Step by Step

Improve Monsters: Step 8

Enter paramters• X = Player.X• Y = Player.Y

Done!

Page 197: Intro to Construct 2: Ghost Shooter - Step by Step

Improve Monsters: Done!

Page 198: Intro to Construct 2: Ghost Shooter - Step by Step

18. Instance Variablese.g. NPC Health

Page 199: Intro to Construct 2: Ghost Shooter - Step by Step

Add Health: Step 1

Select Monster

Page 200: Intro to Construct 2: Ghost Shooter - Step by Step

Add Health: Step 2

Click

Page 201: Intro to Construct 2: Ghost Shooter - Step by Step

Add Health: Step 3

Click Add New(plus sign)

Page 202: Intro to Construct 2: Ghost Shooter - Step by Step

Add Health: Step 4

Enter the following:• Name: health• Type: Number• Initial Value = 5• Description (optional)

OK!

Page 203: Intro to Construct 2: Ghost Shooter - Step by Step

Add Health: Done!

Page 204: Intro to Construct 2: Ghost Shooter - Step by Step

Update Health: Step 1

Right-clickMonster – Destroy

then

click Replace action

Page 205: Intro to Construct 2: Ghost Shooter - Step by Step

Update Health: Step 2

Select “Monster”

then

Next!

Page 206: Intro to Construct 2: Ghost Shooter - Step by Step

Update Health: Step 3

Select “Subtract from”then

Next!

Page 207: Intro to Construct 2: Ghost Shooter - Step by Step

Update Health: Step 4

Enter• Value = 1

“Monster”“Monster”

Done!

Page 208: Intro to Construct 2: Ghost Shooter - Step by Step

Update Health: Done!

Page 209: Intro to Construct 2: Ghost Shooter - Step by Step

19. Affecting NPC Healthi.e. destroying monsters!

Page 210: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 1

Go to yourEvent Sheet

Page 211: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 2

Click to Add Event

Page 212: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 3

Select “Monster”

then

Next!

Page 213: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 4

Select “Compare instance variable”then

Next!

Page 214: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 5

Done!

Enter:• Comparison: ≤ Less or equal• Value = 0

Page 215: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 6

Click to Add Action

Page 216: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 7

Select “Monster”

then

Next!

Page 217: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 8

Select “Spawn another object”then

Next!

Page 218: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 9

<click to choose>

Page 219: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 10

Select “Explosion”

then

OK!

Page 220: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 11

Done!

Enter:• Layer = 1• Image point = 0

Page 221: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 12

Click to Add Action

Page 222: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 13

Select “Monster”

then

Next!

Page 223: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Step 14

Select “Destroy”then

Done!

Page 224: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Monsters: Done!

Page 225: Intro to Construct 2: Ghost Shooter - Step by Step

20. Global Variablese.g. player score

Page 226: Intro to Construct 2: Ghost Shooter - Step by Step

Add Score: Step 1

Right-click, then click Add global variable

Page 227: Intro to Construct 2: Ghost Shooter - Step by Step

Add Score: Step 2

Enter:• Name: Score• Type: Number• Initial value: 0• Description (optional)• Constant?

OK!

Page 228: Intro to Construct 2: Ghost Shooter - Step by Step

Add Score: Step 3

Scroll to the topto see it!

Page 229: Intro to Construct 2: Ghost Shooter - Step by Step

Add Score: Step 4

Click Add action

Scroll back to the bottom

Page 230: Intro to Construct 2: Ghost Shooter - Step by Step

Add Score: Step 5

Select “System”

then

Next!

Page 231: Intro to Construct 2: Ghost Shooter - Step by Step

Add Score: Step 6

Select “Add to”

then

Next!

Page 232: Intro to Construct 2: Ghost Shooter - Step by Step

Add Score: Step 7

Enter:• Value = 1

Done!

Page 233: Intro to Construct 2: Ghost Shooter - Step by Step

Add Score: Done!

Page 234: Intro to Construct 2: Ghost Shooter - Step by Step

21. Adding a HUD i.e. Heads-Up Display

Page 235: Intro to Construct 2: Ghost Shooter - Step by Step

Add HUD Layer: Step 1

ClickLayers

Page 236: Intro to Construct 2: Ghost Shooter - Step by Step

Add HUD Layer: Step 2

Add a new layer(plus sign)

Page 237: Intro to Construct 2: Ghost Shooter - Step by Step

Add HUD Layer: Step 3

Right-clickthen

click Rename

Page 238: Intro to Construct 2: Ghost Shooter - Step by Step

Add HUD Layer: Step 4

Changethe nameto “HUD”

Page 239: Intro to Construct 2: Ghost Shooter - Step by Step

Add HUD Layer: Step 5

Let’s updatethe Parallax

values…

Page 240: Intro to Construct 2: Ghost Shooter - Step by Step

BUT FIRST… WHAT IS PARALLAX?

When the background layers

scroll separately

Source: Super Mario Bros, from Nintendohttp://wakeupandcode.com/c2/parallax.html

Page 241: Intro to Construct 2: Ghost Shooter - Step by Step

Add HUD Layer: Step 6

Set the HUD’sParallax to

0, 0

Page 242: Intro to Construct 2: Ghost Shooter - Step by Step

Add HUD Layer: Done!

Page 243: Intro to Construct 2: Ghost Shooter - Step by Step

22. Displaying Texte.g. player score

Page 244: Intro to Construct 2: Ghost Shooter - Step by Step

Display Text: Step 1

then Insert new object

Right-clicktop left

of Layout 1

Page 245: Intro to Construct 2: Ghost Shooter - Step by Step

Display Text: Step 2

Select“Text”

then

Click Insert

Page 246: Intro to Construct 2: Ghost Shooter - Step by Step

Display Text: Step 3

Click to placeText object(HUD layer)

Page 247: Intro to Construct 2: Ghost Shooter - Step by Step

Display Text: Step 4

NoticeText object

Page 248: Intro to Construct 2: Ghost Shooter - Step by Step

Display Text: Step 5

Change Properties

• Font• Style: Bold Italic• Size: 24

• Color: Yellow

Page 249: Intro to Construct 2: Ghost Shooter - Step by Step

Display Text: Done!

Page 250: Intro to Construct 2: Ghost Shooter - Step by Step

23. Updating the HUDe.g. showing player score

Page 251: Intro to Construct 2: Ghost Shooter - Step by Step

BUT FIRST… HOW DO YOU COMBINE TEXT?

"Score: " & ScoreString Variable

&(ampersand)

spacequote quotetext

Page 252: Intro to Construct 2: Ghost Shooter - Step by Step

Score: 100

WHAT WILL IT LOOK LIKE IN THE GAME?

"Score: " & Scoredisplays

Page 253: Intro to Construct 2: Ghost Shooter - Step by Step

Display Score: Step 1

ClickAdd action

For System, Every tick

Page 254: Intro to Construct 2: Ghost Shooter - Step by Step

Display Score: Step 2

Select “Text”then

Next!

Page 255: Intro to Construct 2: Ghost Shooter - Step by Step

Display Score: Step 3

Select “text”then

Next!

Page 256: Intro to Construct 2: Ghost Shooter - Step by Step

Display Score: Step 4

Enter:• “Score: “ & Score

Done!

Page 257: Intro to Construct 2: Ghost Shooter - Step by Step

Display Score: Done!

Page 258: Intro to Construct 2: Ghost Shooter - Step by Step

24. Spawning NPCsi.e. more monsters

Page 259: Intro to Construct 2: Ghost Shooter - Step by Step

Spawn Monsters: Step 1

Click to Add Event

Page 260: Intro to Construct 2: Ghost Shooter - Step by Step

Spawn Monsters: Step 2

Select “System”

then

Next!

Page 261: Intro to Construct 2: Ghost Shooter - Step by Step

Spawn Monsters: Step 3

Select “Every X seconds”then

Next!

Page 262: Intro to Construct 2: Ghost Shooter - Step by Step

Spawn Monsters: Step 4

Done!

Enter:• Interval (seconds): 3

Page 263: Intro to Construct 2: Ghost Shooter - Step by Step

Spawn Monsters: Step 5

Click to Add Action

Page 264: Intro to Construct 2: Ghost Shooter - Step by Step

Spawn Monsters: Step 6

Select “System”

then

Next!

Page 265: Intro to Construct 2: Ghost Shooter - Step by Step

Spawn Monsters: Step 7

Select “Create object”then

Next!

Page 266: Intro to Construct 2: Ghost Shooter - Step by Step

Spawn Monsters: Step 8

<click to choose>

Page 267: Intro to Construct 2: Ghost Shooter - Step by Step

Spawn Monsters: Step 9

Select “Monster”

then

OK!

Page 268: Intro to Construct 2: Ghost Shooter - Step by Step

Spawn Monsters: Step 10

Done!

Enter:• Layer = 1• X = 1400• Y = random(1024)

Page 269: Intro to Construct 2: Ghost Shooter - Step by Step

Spawn Monsters: Done!

Page 270: Intro to Construct 2: Ghost Shooter - Step by Step

25. Destroying the Player

Page 271: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Player: Step 1

Click to Add Event

Page 272: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Player: Step 2

Select “Monster”

then

Next!

Page 273: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Player: Step 3

Select “On collision with another object”then

Next!

Page 274: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Player: Step 4

<click to choose>

Page 275: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Player: Step 5

Select “Player”

then

OK!

Page 276: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Player: Step 6

Done!

Page 277: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Player: Step 7

Click to Add Action

Page 278: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Player: Step 8

Select “Player”

then

Next!

Page 279: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Player: Step 9

Select “Destroy”then

Done!

Page 280: Intro to Construct 2: Ghost Shooter - Step by Step

Destroy Player: Done!

Page 281: Intro to Construct 2: Ghost Shooter - Step by Step

Wrap-Up

Page 282: Intro to Construct 2: Ghost Shooter - Step by Step

Construct 2 Tutorials

Online: http://www.scirra.com/tutorials

Page 283: Intro to Construct 2: Ghost Shooter - Step by Step

Construct 2 Forum & FB group

FB: https://www.facebook.com/groups/construct2devs/

Forum: https://www.scirra.com/forum/