I'm having a bit of a problem with my sines and cosines. I thought I'd have a go at making an effect like the exploding lemmings from 'Lemmings', and I've nearly sort of succeeded.
The problem is, when the bits finally run out of gas and start falling back down to earth they all loop around the left. I want them really to just fall straight downwards instead of looking like some sort of pixel aerial acrobatics team.
Does anyone have any advice on how I could do this?
Type bits ;type for the particles Field x Field y Field angle Field power Field r Field g Field b End Type fps=CreateTimer(10) anglenumber=180 ;set angle to 180 for the first particle AppTitle("Exploding Lemming Type Thing","Quit?") Graphics 800,600,0,2 SetBuffer BackBuffer() While Not KeyDown(1) WaitTimer(fps) Cls If MouseDown(1) ;when mouse is down For n=1 To 15 ;make dots from 180 to 360 If anglenumber=<360 ;at 15 degree intervals anglenumber=anglenumber+15 Else anglenumber=180 EndIf explode.bits=New bits explode\x=MouseX() ;where the mouse is explode\y=MouseY() explode\r=Rnd(0,255) explode\g=Rnd(0,255) explode\b=Rnd(0,255) explode\angle=anglenumber explode\power=1 Next EndIf For explode.bits=Each bits If explode\power>=10 If explode\angle<=90 explode\x=explode\x+explode\power*Cos(explode\angle) explode\y=explode\y+explode\power*Sin(explode\angle) Else explode\x=explode\x+explode\power*Cos(explode\angle) explode\y=explode\y+explode\power*Sin(explode\angle) explode\angle=explode\angle-15 EndIf Else explode\x=explode\x+explode\power*Cos(explode\angle) explode\y=explode\y+explode\power*Sin(explode\angle) explode\power=explode\power+1 EndIf Color explode\r,explode\g,explode\b Rect explode\x,explode\y,2,2,1 If explode\y>610 Delete explode EndIf Next Flip Wend End
The problem is, when the bits finally run out of gas and start falling back down to earth they all loop around the left. I want them really to just fall straight downwards instead of looking like some sort of pixel aerial acrobatics team.
Does anyone have any advice on how I could do this?