ID:154666
 
How do i code it so i can make it that a player can attack a mob from anywhere? i somehow got it coded so you haveto look up at it to hit it ( i need north sound est wes,t not just north)
get_step(mob,dir)
Okay, so what you want is that you want to attack anything within 1 tile of you, and not just whatever you are facing?
mob/verb
Attack(mob/M in oview(1))
src.dir = get_dir(src,M)
//Attack stuff here
Your question could use a bit more detail.

Avainer1 wrote:
mob/verb
> Attack(mob/M in oview(1))
> src.dir = get_dir(src,M)
> //Attack stuff here
>

This is a valid solution if you want the game to automatically turn the mob to face any target in any adjacent tile.

mob/verb/Attack(mob/m in get_step(src, dir))
// Attack stuff here

This is another solution. As long as there is only one mob (m) in the tile the player is facing, it will be hit.
The get_step() proc returns a turf, and in the verb arguments, the verb searches for mobs inside that turf.

If you're using native pixel movement in your game, you will have to utilize a proc that searches obounds() in a given direction relative to the attacker.