bezier curve problem

Blitz3D Forums/Blitz3D Programming/bezier curve problem

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Why do my aliens always seem to swoop off to the left with the following code. i.e the bezier curve generated always seems to loop off to the left and not random left/right as I want (Hope you get that).

bezier co-ords generated here:


If swoop_num<max_swoop

If inv1\swoop=False
swoop_on=Rnd(0,swoop_freq)
If swoop_on=0
swoop_num=swoop_num+1
inv1\swoop=True
inv1\x1=inv1\x
inv1\y1=inv1\y
inv1\cmx1=inv1\x1+Rnd(-400,400)

inv1\cmy1=inv1\y1+Rnd(-100,100)

inv1\x2=Rnd(100,700)
inv1\y2=600
inv1\cmx2=Rnd(-500,500)
inv1\cmy2=Rnd(-400,400)
EndIf
EndIf

EndIf

here the beizer code:


If inv1\swoop=True

inv1\t#=inv1\t#+0.004

inv1\x= inv1\x1*(1-inv1\t)^3 + 3*inv1\cmx1*(1-inv1\t)^2*inv1\t + 3*inv1\cmx2*(1-inv1\t)*inv1\t^2 + inv1\x2*inv1\t^3
inv1\y= inv1\Y1*(1-inv1\t)^3 + 3*inv1\cmy1*(1-inv1\t)^2*inv1\t + 3*inv1\cmy2*(1-inv1\t)*inv1\t^2 + inv1\y2*inv1\t^3

If inv1\y=>600;inv1\t#>=1
inv1\t#=0
swoop_num=swoop_num-1
;inv1\swoop=False
Delete inv1

EndIf
EndIf