powers
var/offensive = 1
var/icon
var/icon_state
heatbeam
ppcost = 1
name = "Heat Beam"
icon = 'HeatBeam.dmi'
icon_state = "base"
mob
verb
Power1()
set hidden = 1
if(src.Power1)
var/powers/s = text2path("/powers/[ckey(src.Power1)]")
var/powers/a = new s
a.activate(src,src.target)
powers
proc
activate(mob/o,mob/m)
if(!src.offensive)
src.Use(o)
return
var
damage=10
var/icon/_icon = src.icon
var/obj/b = icon(_icon,src.icon_state)
step_to(b,m)
if(damage<1)damage=1
if(m in oview(o,world.view))
o<<"You used [name] on [m] for [damage] damage!"
m<<"[o] uses [name] on you for [damage] damage!"
m.hp-=damage
o.deathcheck(m)
Well, as they pointed out, /icon is only graphical therefore it won't move properly. Crashed gave me the suggestion to use Pixel movement and directed me to Theodis' altmove demo. I saw that and found it really cool about the 360 degree movement. So basically I don't really know how I would use trig. to find out what angle the beam would need to be. I'm thinking that I would need to use the distance formula between the player and the target, but I don't know how to do this exactly.
I also I looked at the latest article from Programming Articles which helped me understand pixel movement. If anyone has any suggestions on how to do this, I will be intrested in hearing it.
A vector if you don't know is simply a way of representing a direction and a magnitude(most likely speed). Which will be used to determine how much you move the projectile each tick. To make things more robust it's best to build a Vector datum to work with
Note this is quite a basic implementation for Vector. There is a whole lot more useful stuff you can do with them however I'm trying to keep this simple.
Now for the beam you simply build a Vector from it's start to finish. Normalize it and scale it depending on how fast you want it to move. Then each tick move the beam by the components of the resulting vector
For the end location you need to pass a turf or the beam will never reach the end due to the fact that it's loc is a turf.
[Edit: Whoops made a mistake and forgot to make the right changes when I copied the EAST WEST section of the bottom of the code to make the NORTH/SOUTH stuff :P.]