I am making a platformer and I want to add a melee based attack for my character. I want to the attack to be triggered regardless in which state the character is such as jumping, running. So how can I do this?
The melee attack should be a different object than the player character, and when creating the attack, use player’s position and center it by adding number or using image point (PlayerObject.X() - 20 and PlayerObject.Y() for example).
For image point use the sigma blue button besides the parameter for the creation event, I can’t remember the function name currently.
Then, you can “create” or do the melee attack as long player is alive, and then make sub events to check if player is flying or on ground, and change animation accordingly.
Also i want this attack to be only trigger when a key is press and if held is does not do anything unless the player rapidly press the button
For rapidly pressing/button mashing you can try making variable that’s raised by 10 each time the player press the button (not hold, so use trigger once) and decrease by 1 each second as long it’s more than 0 - try lower or higher value than 10, and check if the variable is above certain amount like 50, then the attack will do/continue.