Falling Arrows

1

Index

Attached Files

The following files have been attached to this tutorial:

.capx

falling-arrows.capx

Download now 185.1 KB
.capx

falling-arrows-2.capx

Download now 216.55 KB

Stats

3,902 visits, 7,603 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

up date CAPX

Simple games for beginners in construct 2. I have used this and many more will be done which will be variables to everyone on Construct 2 site free of charge. Many of you who started or going to start using Construct 2 licence version or free version will be benefit from these tutorials I will be posting here. These tutorials were done for some friends whom are teachers and for my grandchildren’s.

1. Open Construct and create new project name it as you like. I call mine Falling Arrows

2. Set windows size to 480, 854

3. Set layout size same as above 480, 854

4. Now for background we can add sprite or color.

I am using sprite for this tutorial. So create sprite size 480, 854 and place it on your layout call this sprite Background and also call layer as Background too. Lock it.

Add another layer and name it Player. For this tutorial I am not going to use fancy or hi resolutions sprites but, just shapes to represent objects.

1. Create sprite size 480, 80, color it green, name it Grassland, and place it on player layer.

2. Create sprite size 50, 50 and color it blue, name it player. Place it on player layer.

3. Crate sprite size 12, 60 any color and name it Arrow.

4. Now please go back to Background and add 4 more frame different colors.

For this project add touch and browser for now.

Your layer should look like below:

Now if you run it color screen start flashing fast.

Open your event editor and add some codes:

Start of Layout (actions) stop animation

System every tick (actions) Player set X to touch X (optional) non-compulsory. My code only use below code.

Touch is in touch (action) Player set X to touch X

Reason for set X is we are only going to use X coordination’s Y can stay at 745. Now if you test run our player goes out of layer and that is not good in any game. Solution for this is to check player movements and act accordingly. For this we need sub condition. Here how we do that

System compares two values

System Touch.X is less or equal to 0 (Zero) then player set X to 25 (25)

Now you be asking where he got number 25 from. Now if you remember our player is 50 x 50 so half of 50 are 25 simple.

Now just copy above code and change it like below

System Touch.X is greater or equal to 480 (480) then player set X to 455 (455) remember 50 x 50 size of player. Code looks like below:

Now our player is done next we have to add some actions for arrow.

First create Global Variable and name it arrowSpeed = 2

Now to move arrow about we need to add ACTION

We want System Every tick (Action) Move at angle

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!