Construct2 Manual
Construct2 Manual
Construct 2
Ghost Shooter
c. Setting up screen
i. In the Projects tab, click on the name of the project
ii. In the project settings, located in the Properties tab, set:
Fullscreen in browser -> Off
Window Size -> 640,480
3. Adding input objects
a. Double click on an empty space to open the Insert new object dialogue
b. Select the Mouse object, to add input from your mouse
c. Double click on an empty space to open the Insert new object dialogue
d. Select the Keyboard object, to add input from your keyboard
4. Adding game objects
a. Double click again to open the Insert new object dialogue
b. Double click on the Sprite object
c. When the crosshair pointer appears, click the position (on the layout) where your
object should appear
d. On the Texture Editor, click the open button, navigate to the player object and
click open. Close the editor.
e. Rename the object to player using the PropertiesP editor
f. Do the same for Ghost, Bullet and Explosion objects. Position the bullet and
explosion object at the edge of the screen, outside of the layout screen.
5. Adding behavior
a. Player
i. Click on the Player to select it
ii. In the Properties bar, click on edit behaviors
iii. On the Behaviors dialogue that appears, choose the 8-directional under
the Player movements category
iv. Now add, Scroll to (makes the screen follow the player), Bound to layout
(keeps the player inside the layout)
b. Bullet
i. Click on the Bullet object to select it
ii. In the Properties bar, click on edit behaviors
iii. On the Behaviors dialogue, add to the bullet:
Bullet movement
Destroy outside layout
CTS COLLEGE OF BUSINESS AND COMPUTER SCIENCE LTD.
c. Monster
i. To the monster object, add:
Bullet movement
d. Explosion
i. To the explosion object, add:
Fade
e. Changing speed
i. On the monster objects Properties under Behaviors, change the Speed
from 400 to 80
ii. On the bullet objects Properties under Behaviors, change the Speed from
400 to 600
iii. On the explosion objects Properties under Behaviors, change the Fade
out time from 1 to 0.5
f. Adding more monsters
i. While holding control, click and drag the Monster object.
ii. Create about 6 8 monster objects
6. Adding events
a. Click on the Event Sheet
b. To let the Player face the mouse:
i. Double click on the event sheet.
ii. In the Event dialogue, add a System event and click next.
iii. In the General category, add Every tick
iv. Click on the add action button on the even that was created and choose
the Player object, click next
v. In the Angle category, choose the Set angel toward position
vi. In the Parameters dialogue box that appears:
X : Mouse.X
Y: Mouse.Y
Click done
7. Adding game functionality
a. Adding shooting effect
i. Click the Add event option on the Event sheet
ii. Choose Mouse on the Event dialogue, click Next
CTS COLLEGE OF BUSINESS AND COMPUTER SCIENCE LTD.
iii. Choose On Click, leave the options as default and click done
iv. Click Add action, on the mouse event and in the dialogue that appears
choose the Player object and click next
v. In the Misc. category, choose the Spawn another object.
vi. In the dialogue appears, in the object menu, choose bullet.
vii. In Layer, change 0 to 1
viii. Make bullet fire from the gun
Right click on the Player object in the Projects bar and choose
Edit Animations in the drop-down that appears.
In the Image Editor, click the Set Origin and Image Points tools.
When the crosshair pointer appears, click at the edge of the
players gun
Double click on the Spawn an object action and change the image
point from 0 to 1
Adding sound effects for fire
a. On Sounds in the Projects bar, right click and choose
Import Sounds. Import the audio file.
b. On Object Types in the Projects bar, right click and choose
Insert New Object
c. In the Media category, choose the Audio Object
d. On the Mouse event (that spawns the bullet), choose the
Add Action option, choose Audio object and click Next.
e. In the General category, choose Play and choose the
audio file
f. Leave other options as default and click done
ix. Get the bullets kill monsters
Click the Add event option on the Event sheet
Choose Bullet and click next
In the Collisions category, choose the On collision with another
object option and click next
In the dialogue that appears, choose the Monster object
Click the Add action option on the event and choose the Monster
object.
CTS COLLEGE OF BUSINESS AND COMPUTER SCIENCE LTD.
ii. In the Size and Position category, choose the Is outside layout option and
click done
iii. Add action using the Add Action option on the event, choose Monster
iv. In the Angle category, choose the Set angle toward position
v. In the dialogue that appears
In X type: Player.X
In Y type: Player.Y
vi. Click done
8. Instance variables (Health for monsters)
a. Click on the Monster object in the Projects bar
b. Choose edit under the Instance variables in the Properties tab
c. In the dialogue that appears, choose the Add button
d. In the dialogue, do:
i. In Name input type Health
ii. Change Initial value from 0 to 5
iii. Click done and close the dialogue
e. Change event to allow health of monsters
i. On the Bullet -> On collision with monster event, right click on the Destroy
action and choose Replace action from the drop-down
ii. Choose Monster from the dialogue and in the Instance variables category
choose the Subtract from option and click next
iii. Leave the defaults and click Done
iv. Add another event using the Add Event button and choose System from
the dialogue
v. In the Global & local variables category, choose Add to
vi. In Variable put MonsterSpeed and in Value type 1
f. Destroy Monster when health reaches zero
i. Add another event using the Add Event button and choose Monster from
the dialogue
ii. In the Instance variables category, choose the Compare instance variable
and click next
iii. In the Comparison input change to Less or equal to and click done
iv. Add another action, choose Monster and in the Misc. category, choose
Spawn another object and click next
CTS COLLEGE OF BUSINESS AND COMPUTER SCIENCE LTD.