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,905 visits, 7,606 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.

You must be thinking why move angle at 90, well reason is:

UP = 270

DOWN = 90

RIGHT = 0

LEFT = 180

So we want our Arrow to fall downwards therefore angle is 90 and falling down speed is 2. I hope this make sense.

Now if you run it Arrow falls down but to slow, I would say set arrowSpeed = 12 and see. Also we have only one arrow that is not good in our game. We need to spawn more arrows and randomly too.

So we set our arrow up as Y to minus 40 and X to 20 and X 450. Before I go any further student must learn to use VARIABLES just like I am doing. Reason for this that if you have 250 lines of code where you have line to spawn something every so and so. You only need to change GLOBAL VARIABLE and not all the lines need changing. I hope this make scene try it with one arrow falling and player will adapt and learn to dodge or move in and out therefore you need some kind of game set.

Here is code below:

To make our game interesting we need to add score and update score too.

Create TEXT and name it txtScore also add Global Variable Score = 0

Place txtScore at bottom of layer and set text size and text as you like. Now one thing you should always do is drag the Every Tick to top so it starts the loop from top.

Now add this line of code:

  • 0 Comments

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