Platformer The Alien

Report 5 Downloads 107 Views
Platformer - The Alien

DIRECTIONS: Follow along with the Platformer - The Alien screencast while following along with this step-by-step instruction sheet. ❏

Open the existing “Platformer” project in Construct 2

● Insert your USB/Flash Drive and go to COLESTOCK > GAMEDEV > Platformer ● Double-click on the “Platformer.capx” project file

NOTE: When developing in Construct 2, we will use primarily two tabs: PROJECTS and LAYERS. ❏

Create the Alien

● Make sure “Content” layer is active and unlocked ● Right-click OBJECT TYPES > Select “Insert new object” ● Select “Sprite” > Name when inserted: "Alien" > INSERT ● When crosshair appears, click inside “Game” layout > Edit image dialog box will appear > Click folder icon ● Browse to and OPEN: Platformer > media > alienA.png ● Click X to close; Alien should be on the “Content” layer



Assign behaviors to the Alien

● Select the Alien > Set the following properties: ○ Behaviors ■ Add / Edit > BEHAVIORS ■ Select plus “+” icon ■ Select “Platform” under “Movements” > ADD ■ Select “ScrollTo” under “General” > ADD ■ Select “BoundToLayout” under “General” > ADD



Adjust Alien’s Collision Polygon

● Select the Alien > Right-click > Select “Edit animations” ● Select “Set collision polygon” ● Adjust polygon to reflect Alien’s true size ● Deselect “Set collision polygon” ● Click X to close



Animate the Alien

● Select the Alien > Right-click > Select “Edit animations” ● In the “Animations” window > Select “Add animation” ● Rename new animation to “Walk”; make sure it is highlighted ● Create a six-frame animation with the following frames: ○ ○ ○ ○ ○ ○

Frame 0: Frame 1: Frame 2: Frame 3: Frame 4: Frame 5:

alienA.png alienB.png alienC.png alienB.png alienA.png alienC.png

For each frame you need to create: Click the folder icon > Navigate to the image file (.png) > Select “Open” > Right-click “add frame” in the “animation frames” window Then Select “Set collision polygon” > Adjust polygon to reflect Alien’s true size > Deselect “Set collision polygon” ● Right-click “Delete” any remaining empty frame ● Click X to close the “Edit image” window ❏

Set Alien’s “Walk” Animation Properties

● Select the Alien > Right-click > Select “Edit animations” > Select “Walk” animation > Set the following properties: ○ Animation ‘Walk’ properties ■ Speed: 8 ■ Loop: Yes ● Click X to close



Add Code to Game Sheet to Animate the Alien

● Under “Event Sheets” > Right-click “Game Sheet” > OPEN ● Click “Add event” Double-click "Alien" Select "Is moving" (under "Platform") Select "Add action" Double-click "Alien" Select "Set animation" (under “Animations”); set these values: ■ Animation: "Walk" ■ From: beginning ○ Select DONE ○ ○ ○ ○ ○

● Click “Add event” Double-click "System" Select "Else" (under "Special conditions") Select "Add action" Double-click "Alien" Select "Set animation" (under “Animations”); set these values: ■ Animation: "Default" ■ From: beginning ○ Select DONE ○ ○ ○ ○ ○





Add the Keyboard to the Project

● Right-click OBJECT TYPES > Select “Insert new object”

Add Code to Game Sheet to “Mirror” the Alien

● Under “Event Sheets” > Right-click “Game Sheet” > OPEN

● Select “Keyboard” (Under “Input”) > INSERT

● Click “Add event” Double-click "Keyboard" Select "On key pressed" (under "Keyboard") Select "Left arrow" key > DONE Select "Add action" Double-click "Alien" Select "Set mirrored” (under “Appearance”); set these values: ■ State: "Mirrored" ○ Select DONE ○ ○ ○ ○ ○ ○

● Click “Add event” ○ Double-click "Keyboard" ○ Select "On key pressed" (under "Keyboard")

Select "Right arrow" key > DONE Select "Add action" Double-click "Alien" Select "Set mirrored” (under “Appearance”); set these values: ■ State: "Not Mirrored" ○ Select DONE ○ ○ ○ ○

Before continuing, double-check your Game Sheet code; make sure it matches the following: ❏



Double-check “Game Sheet”

Play/Test Game

● Make sure “Game” Layout is selected ● RUN LAYOUT (play button at top)