Platform game Start to Finish

3

Index

Attached Files

The following files have been attached to this tutorial:

.capx

demo-game.capx

Download now 5.33 MB

Stats

8,941 visits, 18,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.

Published on 22 May, 2018. Last updated 19 Feb, 2019

To manipulate Wall_X and Wall_Y whenever we want the player to jump over any obstacle which is higher than a player can Jump. Here is how we achieve our result for jumping higher. Pressing key W is pressed we are also checking the player is not on the floor. If Player is on the floor this line will be ignored. To add Sub Event Just press B on the keyboard, remember that first you must highlight the line then press B.

I am checking in this lines of code, is their wall to the left of player, if there is then set Vector X to our Local variable Wall_X, Wall_Y, and also same goes for a Right wall.

Ok test your game should work as we have expected.

Create sprite, and name it Bullet, set property, behaviour Bullet, set the speed to 400, and destroy outside layout,

Add Global Variable in Global Event Sheet, Num_Ammo = 100. In Function Event Sheet enter these lines;

Pressing M key on keyboard player can fire bullets towards Enemy. If M is pressed then fire gun once or whatever time the M key is pressed but if M key is DOWN the player gunfire bullets continuously until no Ammo left in Gun. The player is set to fire bullets at every 0.06 seconds, and at the same time, we are subtracting Num_Ammo from 100. Also, we have to check if player facing Right or Left. If player face Right then set Bullet angle to 0 and if facing left set angle to 180 degrees. We check this by the player is Mirrored or not mirrored. Simple; if you run this and press M key player gun will fire Bullets in the direction player is facing. Now we have to warn player if he or she runs out of Bullets. This we will cover it in HUD display, therefore, do not run your project or it will not work.

We need to check if Bullets are hitting the solid object like Wall and if it is, then we have to destroy it, also we don’t want Bullets to carry on, on. Once bullets have travelled a certain amount, we just destroy it.

Please create Groups and add all those code snippets in like so;

  • 0 Comments

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