
//**** Move proc (it creates the trail) ****
Head
icon='icon.dmi'
density=1
Move()
var/obj/Trail/T=new/obj/Trail
T.loc = src.loc
T.dir = src.dir
..()
I want the above player's attack to be better visually.
It works by targeting a mob, then a 'head' obj is sent out with step_towards, each movement results in a 'trail' obj being left in its place.
I'll figure out the pixel art, no worries...
But as you can see, the corners are non existent.
I was wondering if someone could help me out with a proc to check if the obj turns; and if it does, put in the appropriate trail obj.
I'd rather it would only move in straight lines too...
Oh. And I want the head to pass through/over solid turfs and objs.
Bump(A)
if(ismob(A))
var/mob/M = A
if(src.target!=M)
src.loc=M.loc
else
src.density=0
M.ShadowCaptured(src)
if(istype(A,/turf/))
var/turf/T = A
if(T.density)
src.loc=T.loc
if(istype(A,/obj/))
var/turf/O = A
if(O.density)
src.loc=O.loc
But it doesnt work :|
You should first let the parent proc run, then check if movement actually succeeded before creating a trail.
Also, you should properly use new and use the location argument; also, be aware of the type shortcut; if you haven't specified a type and you are assigning the object into a var, the var's defined type is used. So your new line becomes:
What's the problem? If an object turns, it usually means it has changed it's dir var (unless custom code made it otherwise). You can store the projectile's dir into a local var before calling the parent proc, then afterwards checking if it has changed - if it has, then the object has turned. You may then decide what icon to use for that trail,
Err, you mean in the 4 cardinal directions, right? You need to write your own equivalent of step_towards() then, that doesn't use diagonals.
Search around before posting...there have been a few topics about this, lately. You need to override Enter(), Bump() is definetely not the way to go. In there, you want to always allow the projectile entrance to turfs unless the turf is solid or it contains a solid mob; in this approach, Bump() may be called on a solid obj that was present in the turf (but didn't hamper entrance), so you should call another proc (in a spawn() call, spawn(-1) if wanted, so Enter() continues and returns so does the move proccess) such as projectile.Hit(dense_mob) from the Enter() and not use Bump() to damage.