Open Player events and add this line of code.
NOTE: ALL THIS CODE MUST GO IN Player_Event
Pin weaponmask to spr_Player
Before we go further we need to add some Global Variables below:
Please create Group and name it Player Weapons. Inside this group create another group and name it Sword Attack. In Sword attack group add sub event, add this lines of code.
This code is simple enough to understand I hope!
Please create Group and name it Player Weapons. Inside this group create another group and name it Knife Attack. In Knife attack group add sub event, add this lines of code.
Click on num_Ammo > 0 and on keyboard press B his is simple way adding SUB EVENT
So what are we doing here is if num_Ammo is more than zero set our Variable is_Shooting to Zero.
Next we are checking Keyboard input is UP ARROW is down
Also Hudbar_Move is = 2
And Player_Direction = “idle” Inverted
System compare Variable is_Shooting = 0 Function call “Bullet Type”
System compare Variable Reload_Time = 0 Add 1 to reload_Time
Function call “Bullet Timer”
I am using Knife for projectile using Bullets behaviour that is why I am using Bullet_Type.
Now we create Function “Bullet Type”