It is vector math (or trig, whichever you prefer). So, here goes:
Here is a triangle:
This represents a line at 30 degrees going 10 units. The red is the Y axis difference between the starting and the ending points (the rise) and the blue is the x axis difference (the run).
Since we know (or don't know, if you don't, its true, trust me) that:
Sin=Opposite/hypotenuse
Cos=Adjacent/Hypotenuse
Tan=Opposite/Adjacent
Here Opposite is the length of the side of the triangle opposite from the angle, adjacent is the length of the side next to the angle (but not the hypotenuse) and the hypotenuse is the longest side of the triangle.
ArcSin,ArcCos,and ArcTan (the commands are asin,acos, and atan in DBC) are ways to say Angle whose _____ is ______. So if I say arctan of the triangle above, it would be: The angle whose tangent is red/blue (since red is opposite and blue is adjacent). That is how you would find the angle between the waypoint and the enemy.
Now, to explain speed*sin and speed*cos. When moving, we will say that the angle has been computed using arctan and we found it to be 30 degrees and, say 30 units away. If we can go 10 units in a step, that will take 3 steps to get there (30/10=3). That part is simple, but when you need to find the coordinates, you have to use trig.
The speed is your hypotenuse, and is 10 in this case (since the hypotenuse on the triangle is 10).
We are trying to find the length of blue and red. Since sin30=Red/speed and cos30=blue/speed. It can be found that multiplying by the speed you get these two formulas:
speed*sin(30)=red
speed*cos(30)=blue
If you haven't been exposed to trig yet, don't worry, you will be sooner or later. If you have any questions, I have been able to get a decent handle on it, so just ask.
Hope this cleared it up for you!
[EDIT]
@Irojo:
Not too bad (I am at it again

)
My suggestion: Instead of having two sub sections in the array for destination x and destination y, use 1, and have that be for the waypoint number.
Then you can create a waypoint array, with a total number of waypoints for the first division, and then 2 for the coordinates so:
DIM WayPoints(totalwaypoints,2)
That way editing it is easy and you only have to alter one section of the code, rather than find where it resets the destination.
Also, clean your code a bit. It looks like you got the commenting down, but a simple blank line here and there would do wonders for you code. Observe:
rem DNG - Enemy Control - Irojo
rem The enemies Array
remstart
---------------Foe(totalcreeps,5) Array Usage---------
Creep(Creepsnumber,0) = x
Creep(Creepsnumber,1) = y
Creep(Creepsnumber,2) = Face Type
Creep(Creepsnumber,3) = Speed
Creep(Creepsnumber,4) = Destination X
Creep(Creepsnumber,5) = Destination Y
remend
rem Starting Arrays (set once)
startx=320
starty=0
targetx=400
targety=400
rem Changeable Arrays (desirable to change)
totalcreeps=10
speed=10
rem Default Arrays (do not change, place every wave)
spawns=0
rem Foe array. Should be reDIMed every wave.
DIM Foe(totalcreeps,5)
rem Setting the faces to one. This should NOT
rem be used in the final. This is only so
rem I only have to use 1 image while testing.
for setcurrent=1 to totalcreeps
Foe(setcurrent,2)=1
next setcurrent
rem This is the image that will not be kept,
rem but is needed for the testing.
box 0,0,26,26
get image 1,0,0,26,26
rem --
rem Setup
sync on:sync rate 0
do
cls
gosub Creeps
sync
loop
rem |--------------=============------------|
rem ---|The Important Creep Control Subroutine.|---
rem |--------------=============------------|
Creeps:
if spawns<totalcreeps
inc spawns,1
Foe(spawns,0)=startx
Foe(spawns,1)=starty
Foe(spawns,3)=speed
endif
rem Controls all spawned creeps
for Control=1 to spawns
if Foe(Control,0)>targetx then Foe(Control,0)=Foe(Control,0)-Foe(Control,3)
if Foe(Control,0)<targetx then Foe(Control,0)=Foe(Control,0)+Foe(Control,3)
if Foe(Control,1)>targety then Foe(Control,1)=Foe(Control,1)-Foe(Control,3)
if Foe(Control,1)<targety then Foe(Control,1)=Foe(Control,1)+Foe(Control,3)
next Control
rem Checks the current face number, and pastes
rem that onto the correct x and y.
for showimage=1 to totalcreeps
paste image Foe(showimage,2),Foe(showimage,0),Foe(showimage,1)
next showimage
return
And this (same code, just spaced out a little more)
rem DNG - Enemy Control - Irojo
rem The enemies Array
remstart
---------------Foe(totalcreeps,5) Array Usage---------
Creep(Creepsnumber,0) = x
Creep(Creepsnumber,1) = y
Creep(Creepsnumber,2) = Face Type
Creep(Creepsnumber,3) = Speed
Creep(Creepsnumber,4) = Destination X
Creep(Creepsnumber,5) = Destination Y
remend
rem Starting Arrays (set once)
startx=320
starty=0
targetx=400
targety=400
rem Changeable Arrays (desirable to change)
totalcreeps=10
speed=10
rem Default Arrays (do not change, place every wave)
spawns=0
rem Foe array. Should be reDIMed every wave.
DIM Foe(totalcreeps,5)
rem Setting the faces to one. This should NOT
rem be used in the final. This is only so
rem I only have to use 1 image while testing.
for setcurrent=1 to totalcreeps
Foe(setcurrent,2)=1
next setcurrent
rem This is the image that will not be kept,
rem but is needed for the testing.
box 0,0,26,26
get image 1,0,0,26,26
rem --
rem Setup
sync on:sync rate 0
do
cls
gosub Creeps
sync
loop
rem |--------------=============------------|
rem ---|The Important Creep Control Subroutine.|---
rem |--------------=============------------|
Creeps:
if spawns<totalcreeps
inc spawns,1
Foe(spawns,0)=startx
Foe(spawns,1)=starty
Foe(spawns,3)=speed
endif
rem Controls all spawned creeps
for Control=1 to spawns
if Foe(Control,0)>targetx then Foe(Control,0)=Foe(Control,0)-Foe(Control,3)
if Foe(Control,0)<targetx then Foe(Control,0)=Foe(Control,0)+Foe(Control,3)
if Foe(Control,1)>targety then Foe(Control,1)=Foe(Control,1)-Foe(Control,3)
if Foe(Control,1)<targety then Foe(Control,1)=Foe(Control,1)+Foe(Control,3)
next Control
rem Checks the current face number, and pastes
rem that onto the correct x and y.
for showimage=1 to totalcreeps
paste image Foe(showimage,2),Foe(showimage,0),Foe(showimage,1)
next showimage
return
Also, I indented your subroutine to make it more obvious where it stops and starts. This isn't super important when you only have a couple subs, but it gets REALLY helpful when you have a LOT and you are looking for where a new one begins.
Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?