Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var attackRadius:int = 30 // the radial distance from the player that the sword reaches
- var attackAngle:int = 80 // the actual angle of the sword slash
- // within for loop of enemies
- // check if enemy is close enough for the sword to reach/hit it
- If(getDist(enemy,player) <= attackRadius){
- // calculate if the enemy is within the attackAngle area in front of the player
- if(getAngleToObj(player,enemy) <= (player.rotation + attackAngle/2) || getAngleToObj(player,enemy) >= (player.rotation - attackAngle/2) {
- // enemy is within slash area, deal damage
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement