ID:162432
 
I would like somone to create a demo on turning beam proc for a dbz games a actual homing beam, although i'm not to particular to math this factor bewilders me.


sequances beam finds usr Y.axis stops turns usr.X axis stops when aligned proceeds usr.dir contact dmg.

------
i
i
i
-------[X].dmg

all dir.
mob/verb/Doom(mob/m in view())
set name="TURNING BEAM OF DOOM"
set category="Ultra Cool Moves"
var/obj/beam/b=new/obj/beam
if(m.y>b.y)b.dir=NORTH
else b.dir=SOUTH
view()<<"<B>TURNING BEAM OF DOOM!"
while(src.y!=b.y)step(b,b.dir)
//Now Its at the Y value of the person
if(m.x>b.x)b.dir=EAST
else b.dir=WEST
while(src.x!=b.x)step(b,b.dir)

=p
In response to Tubutas
:) ty
In response to Tubutas
Your new statement needs parenthesis.
var/obj/beam/b = new()


Your while statements are checking the beams location against the 'src'. I am pretty sure you should be checking it against 'm'.

You need some sort of sleep statement in the while statements.

Also you should close your html tag.

Perhaps something like this:
mob/verb/US_Beam(mob/m in oview())
set name="Turning Beam of Upset Stomach"
set category="Relatively Cool Moves"
var/obj/beam/b=new(src.loc)
var/d=get_dir(b,m)
b.dir=(d&(d-1))^d
viewers(,b)<<"<B>Behold! The Turning Beam of Upset Stomach</B>"
while(b.y!=m.y)
step(b,b.dir)
sleep(1)
b.dir=d&(d-1)
while(b.x!=m.x)
step(b,b.dir)
sleep(1)
In response to Asielen
Oh yeah good point i rushed it, that'd make a single beam thats no where, if your a decent coder you can figure it out though.

**edit**
wth is <dmb.dir=(d&(d-1))^d</dm>
In response to Tubutas
Tubutas wrote:
wth is b.dir=(d&(d-1))^d</dm>

d if d is a cardinal direction, or the NORTH/SOUTH component of d if it isn't.