Projectile problem in Developer Help
|
|
Code:
obj projectiles FireBall icon = 'FireBall.dmi' density = 1 projectile_type = "Fireball" step_size = 32 New(_x, _y, _z, _dir, _owner) var/tiles=10 owner = _owner step_x=_x step_y=_y z=_z loc=locate(step_x,step_y,z) dir=_dir while(src) step(src, src.dir) tiles-- sleep(1)
mob verb FireBall() view() << "[src.Game_Name]: Fireball!" new/obj/projectiles/FireBall(src.step_x,src.step_y,src.z,src.dir,src)
|
Problem description:
Somehow the fireball object won't appear. When I do
new/obj/projectiles/FireBall(src.x,src.y,src.z,src.dir,src)
|
it works. But the location isnt right.
Maybe you see the problem?
|
That is your problem. If step_x is 10, step_y is 7, and z is 1, you would be locating them to (10,7,1). Notice however, that these are not the caster's x, y, and z variables. The player's step_x/y vars could be 10/7 respectively, while their x and y vars could be 52 and 76, yet you would still be locating the missile at 10,7.
Step_x and step_y are used for pixel movement and reference the number of pixels that the player is offset from their current turf. The x, y, and z vars correspond to the turf that they are located on in the map.