ID:273928
 
I can't seem to get the projectile icon to display how I want when fired. Like So:

P = Player
O = Projectile

P
|
|
|
|
O

It's misaligned on the map grid.

Thanks for the help, or collaboration.
You want a trail you mean?
You have to offset its step_x and step_y
In response to Lugia319
No, let me show you a screenshot:


See how the projectiles are misaligned when I shoot them.
In response to A. Ness
I would imagine you need to set the projectile's offsets to be the same as yours when you fire, otherwise they just line up with the grid.
In response to Robertbanks2
Can I get an example?
In response to A. Ness
A. Ness wrote:
Can I get an example?

projectile.step_x = player.step_x
projectile.step_y = player.step_y
In response to Robertbanks2
Example:

obj/Projectile
var/mob/owner
New(Owner)
owner=Owner
src.step_x = src.owner.step_x;src.step_y = src.owner.step_y
..()


It won't work this way.
In response to A. Ness
A. Ness wrote:
Example:

> obj/Projectile
> var/mob/owner
> New(Owner)
> owner=Owner
> src.step_x = src.owner.step_x;src.step_y = src.owner.step_y
> ..()
>

It won't work this way.

How do you call new()? You're properly passing the shooter as Owner? What specifically is it not doing properly?
In response to Robertbanks2
obj/Projectile
icon = 'Projectiles.dmi'
icon_state = "shot"
density = 1
step_size = 20
bound_y = 8
bound_x = 8
bound_height = 16
bound_width = 16
var/mob/owner1
New(Dir,Loc,Owner)
dir=Dir;loc=Loc;owner1=Owner
walk(src,src.dir,0,20)
src.StepXY()
..()
proc/StepXY()
src.step_x = src.owner.step_x;src.step_y = src.owner.step_y
In response to A. Ness
A. Ness wrote:
> obj/Projectile
> icon = 'Projectiles.dmi'
> icon_state = "shot"
> density = 1
> step_size = 20
> bound_y = 8
> bound_x = 8
> bound_height = 16
> bound_width = 16
> var/mob/owner1
> New(Dir,Loc,Owner)
> dir=Dir;loc=Loc;owner1=Owner
> walk(src,src.dir,0,20)
> src.StepXY()
> ..()
> proc/StepXY()
> src.step_x = src.owner.step_x;src.step_y = src.owner.step_y
>


owner1 and owner are not the same variable. src doesn't need to be stated everywhere, it's assumed that an unlabeled variable belongs to src.

This also doesn't tell me anything about how you CALL new(), it tells me how you defined it, though the owner1/owner variable mixup is probably causing trouble.

Finally, why do you stack everything with semicolons like that? It's ugly and makes your code more obnoxious to read.
In response to Robertbanks2
Yeah owner thing was the problem :P
My bad about the semi-colons, I should of wrote out the code clearly.