Ok I got an enemy wave, using Cos to move on the y and atan2 to set their angle but... as they are now they are all in a line when they are created, when they are created i need them to all ready be in a nice wavey line, but i cant figure it out, ive tried changing lots of things but what every i try they move off the line they need to follow. Can ya help??? I know i need to set some vars when im creating the types but ive tried lots with no success.
!!NO MEDIA NEEDED!!, copy'n'paste and run.
!!NO MEDIA NEEDED!!, copy'n'paste and run.
Graphics 640,480,0,60 Global Ltemp:TList=New TList Type Ttemp Field x#,y# Field waveinc# Field vx#,vy#,angle End Type make(8) ' make 8 ships '=================================== Repeat ; Cls Update() DrawLine 0,240,640,240,1 ' centre point line DrawLine 0,240+64,640,240+64,1 ' top boundry DrawLine 0,240-64,640,240-64,1 ' bottom boundry FlushMem ; Flip ; Until KeyDown(KEY_ESCAPE)=True ; End '==================================== Function Update() For t:Ttemp=EachIn Ltemp If t.x>640 Then t.x=0 ' loop through the screen t.angle = ATan2((t.Y+t.VY) - t.Y , (t.X+t.VX) - t.X) ' get angle t.waveinc:+1 t.vy=Cos(t.waveinc)*0.8 t.y:+t.vy t.x:+t.vx ' ,move on the x SetRotation t.angle SetColor 255,255,255 ; DrawRect t.x-16,t.y-8,32,16 SetRotation 0 Next End Function '------ Function make(count) For i=1 To count t:Ttemp=New Ttemp ListAddLast Ltemp,t t.x=320-(i*64) t.y=240 t.vx=1 Next End Function