Hey there.
I'm working on a spell at the moment and I'm nearly there (I think I'm doing everything leakless in a nice struct and all clean and effective). It's just that my math isn't correct so the movement of the missile is looking very weird, but everything but the movement is acting correct.
Could anyone tell me what I should do in this scenario:
I made a spell that can target a position or a unit. (Something like Shockwave or Carrion Swarm per example)
I'm not using a 'missile' but instead I'm just changing x and y values so I can keep track of my 'invisible missile'. I do this with a timer of 0.05 as its interval.
This 'invisible missile' will create a special effect and do some damage at 0.3, 0.6, 0.9 and 1.2 seconds traveled.
The thing that's going wrong is the direction of the missile. My math is failing and I don't know how to set the new X and new Y of the missile every 0.05 seconds. This 'missile' is supposed to move 30 in the direction of the target of the spell, OR if no target was selected in the direction of the spell's targeted location.
EDIT:
I'm asking for help too fast! I just found out that I made a stupid typo!
Sorry!
This is what I had:
It's supposed to be:
I'm working on a spell at the moment and I'm nearly there (I think I'm doing everything leakless in a nice struct and all clean and effective). It's just that my math isn't correct so the movement of the missile is looking very weird, but everything but the movement is acting correct.
Could anyone tell me what I should do in this scenario:
I made a spell that can target a position or a unit. (Something like Shockwave or Carrion Swarm per example)
I'm not using a 'missile' but instead I'm just changing x and y values so I can keep track of my 'invisible missile'. I do this with a timer of 0.05 as its interval.
This 'invisible missile' will create a special effect and do some damage at 0.3, 0.6, 0.9 and 1.2 seconds traveled.
The thing that's going wrong is the direction of the missile. My math is failing and I don't know how to set the new X and new Y of the missile every 0.05 seconds. This 'missile' is supposed to move 30 in the direction of the target of the spell, OR if no target was selected in the direction of the spell's targeted location.
EDIT:
I'm asking for help too fast! I just found out that I made a stupid typo!
Sorry!
This is what I had:
JASS:
set Dat.x = Dat.x + 30*Cos(Dat.angle)
set Dat.y = Dat.y + 30*Cos(Dat.angle)
It's supposed to be:
JASS:
set Dat.x = Dat.x + 30*Cos(Dat.angle)
set Dat.y = Dat.y + 30*Sin(Dat.angle)