How to create a sword attack after a button is pressed on the scene?
memski425
Member Posts: 19
Hello,
i was wondering how to make a sword attack after pressing an attack button. I am not very sure how to start rule wise.
Thanks in advance
i was wondering how to make a sword attack after pressing an attack button. I am not very sure how to start rule wise.
Thanks in advance
Comments
add a gameAttribute: boolean type … name attack
on buttonActor:
Rule: when
Event: touch is pressed
-changeAttribute: game.attack To: true
on playerActor:
Rule: when
Attribute: game.attack is true
-Animate: drag in 4-8 images
and rule or behavior to change the attack to false …
Ex: Timer: After: 1 second
-changeAttribute: game.attack To: false
MH
Great advise MotherHoose! Thats exactly what he must do.
The question now is how to make the sword actually hurt the enemy. Maybe... invisible actor?
Yes. What you need to do is first have a set of game attributes watching the player X and Y position. You then, at the same time in the rule as the animation, spawn an actor, invisible. Thsi actor will need to have its starting position held to a position relative to the PlayerX and Y. It also will need to have instructions to move itself to match the sword's movement, to damage enemies that impact them (however you want to set that up, it could be an enemy actor reaction (if collides with sword) or so on), and to have a timer to destroy itself at the end of the action.