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;