ID:326542
 
(See the best response by Solomn Architect.)
Code:
mob/var
health

obj/beams/head
var/damage
icon='beams.dmi'
icon_state="head"
density=1
damage=10
Bump(mob/M)
if(ismob(M))
M.health -= damage
del(src)
New()
spawn(20)
del src
..()

obj/beams/tail
icon='beams.dmi'
icon_state="tail"
density=1
Move()
var/T = new /obj/beams/tail(src.loc)
T:dir=src.dir
T:icon_state=src.icon_state
T:icon=src.icon
..()
New()
spawn(20)
del(src)
..()


mob/verb/kamehameha()
var/fired
if(fired) return
if(usr.dir==null) return
fired=1
var/A = new /obj/beams/head(usr.loc)
var/B = new /obj/beams/tail(usr.loc)
A:dir=usr.dir
B:dir=usr.dir
if(A)
walk(A,usr.dir)
spawn(1)
walk(B,usr.dir)
spawn(19)
fired=0

/*
These are simple defaults for your project.
*/


world
fps = 25 // 25 frames per second
icon_size = 32 // 32x32 icon size by default

view = 9 // show up to 6 tiles outward from center (13x13 view)


// Make objects move 8 pixels per tick when walking

mob
step_size = 4

obj
step_size = 8


Problem description:

Well the default pixel movement makes the beam act weird. like the beam goes about half a tile to the side of me. Any ideas how to fix it?
First of all, why are you using the depreciated ":" operator? the "." operator does exactly the same thing, but I digress. Your issue is:
mob/verb/kamehameha()
// ...
fired=1
var/A = new /obj/beams/head(usr.loc) <-- RIGHT THERE
var/B = new /obj/beams/tail(usr.loc) <-- AND THERE
A:dir=usr.dir
// ...


You're specifying the tile location of the target variables, but not the exact pixel location. That just requires a few more simple references and variables, but that's why your beam is off center from the player. I suggest looking up the step_x and the step_y variables to help you out. Extremely simple fix, should be really quick. It'll just require adding a little more code, I see no need to change anything. (Except the : operators...)
if i use the "." it says that the A.dir is an undefined var anyways im looking into the step vars now.
Best response
Ah, I see now. Try this:

mob/verb/kamehameha()
// ...
var/obj/beams/head/A = new/obj/beams/head
var/obj/beams/tail/B = new/obj/beams/tail
A.dir=usr.dir
B.dir=usr.dir
// ...

I suggest you use this method, as the : operator does not check whether the variable is valid for the referenced object at compile time. The . operator does. This minimizes chance for run-time errors related to the code. If you reference a variable not associated with the object, you'll get an error at run-time when you attempt to use the function.

Apologies for being off-topic. I was merely showing you what is a much more preferred solution. The : operator is perfectly fine, but you have to be careful. The . is the safest.
If pixel movement is messing up your projectiles, and pixel movement is not wanted then remove it and its entirety.

If you were planning on setting up a normal projectile system without having to have that unnecessary clot of var/obj/blahblah then you could do it this way:

obj/projectile
var/mob/owner // the owner of the projectile
var/movementspeed = 0 // how fast the projectile moves
var/distance = 0 // not setting this will delete the projectile on create
var/damage = 0 // the amount of damage the projectile does
bullet
icon = 'bullet.dmi'
movementspeed = 1 // moves every tenth of a second
distance = 5 // only moves 5 tiles
damage = 10 // static damage of 10

Bump(mob/m)
if(istype(m)) // check if the atom being bumped is a /mob type
m.takedamage(damage) // causes the player that it bumps to take damage
del(src) // delete the projectile once it has bumped

New(var/turf/newloc, var/newdir, var/mob/newowner)
..()
loc = newloc
dir = newdir
owner = newloc
spawn(-1)
fireprojectile()

proc/fireprojectile()
if(!owner || !distance || !damage) // only fire if variables are set
return
for(var/i = distance, i > 0, i--) // lets get loopy
if(!owner) // break the loop if there is no present owner
break
step(src, dir) // move!
sleep(movementspeed) // wait out the movement delay to move again
del(src) // delete the projectile once it runs out of distance

mob/verb/shootbullet()
new/obj/projectile/bullet(get_step(usr, dir), dir, usr)
// get_step(usr, dir) - finds the turf that is located infront of the usr
// dir - the direction you are facing
// usr - yourself, to be set as the owner

You have posted the same exact broken, terrible code in the past. Are you trying at all?