I really like the way this small project turned out. Thanks Pongo.
Here is a program I call Interactive Amoeba. It uses blob.bmp again.
Click to make more blobs and right click in the middle of a big one to explode it!
Here is a program I call Interactive Amoeba. It uses blob.bmp again.
Click to make more blobs and right click in the middle of a big one to explode it!
Graphics3D 800,600,0,2 SeedRnd(MilliSecs()) SetBuffer BackBuffer() lit=CreateLight() SeedRnd(MilliSecs()) AppTitle "Lava Lamp Particles" cam=CreateCamera() CameraRange cam,.1,1000 PositionEntity cam,0,0,-10 pl=CreatePlane(1,cam) PositionEntity pl,0,0,.15 RotateEntity pl,-90,0,0 EntityAlpha pl,0 EntityPickMode pl,2 Type pnt Field x#,y# Field dx#,dy# Field ent End Type p.pnt = New pnt p\x = 400 p\y = 300 tex = LoadTexture("blob.bmp") p\ent = CreateSprite() EntityTexture p\ent,tex EntityFX p\ent,1 EntityBlend p\ent,3 EntityColor p\ent,0,0,255 While Not KeyDown(1) Cls If MouseHit(1) Then p.pnt = New pnt p\x# = MouseX() p\y# = MouseY() tex = LoadTexture("blob.bmp") p\ent = CreateSprite() EntityTexture p\ent,tex EntityFX p\ent,1 EntityBlend p\ent,3 EntityColor p\ent,0,0,255 EndIf For p.pnt = Each pnt sprite2d(cam,p\ent,p\x#,p\y#,60,0,1) ; If KeyDown(57) Then p\dy# = p\dy# + .05 If MouseDown(2) Then dist# = Sqr((p\x#-MouseX())^2+(p\y#-MouseY())^2) If dist# < 20 Then dx# = p\x# - MouseX() dy# = p\y# - MouseY() p\dx# = p\dx# + dx#/5 p\dy# = p\dy# + dy#/5 EndIf EndIf For g.pnt = Each pnt If p\x# <> g\x# And p\y# <> g\y# Then dist# = Sqr((p\x#-g\x#)^2+(p\y#-g\y#)^2) If dist < 60 Then If dist < 40 Then dx# = p\x# - g\x# dy# = p\y# - g\y# p\dx# = p\dx# + dx#/4000 p\dy# = p\dy# + dy#/4000 Else dx# = p\x# - g\x# dy# = p\y# - g\y# p\dx# = p\dx# - dx#/4000 p\dy# = p\dy# - dy#/4000 EndIf EndIf EndIf Next ; If p\y# > 600 And KeyDown(57) Then ; p\y# = 600 ; p\dy# = -p\dy#/2 ; EndIf Next For p.pnt = Each pnt p\x# = p\x# + p\dx# p\y# = p\y# + p\dy# Next UpdateWorld() RenderWorld() Flip Wend End Function Sprite2D(cam,sprite,x#,y#,size#,ang#,alpha#) ent=CameraPick(cam,x,y) If ent Then PositionEntity sprite,PickedX(),PickedY(),PickedZ() ScaleSprite sprite,size/2560,size/2560 RotateSprite sprite,ang EntityAlpha sprite,alpha End If End Function