Here is another version with the controls at the top of the screen. It think this will be easier to control!
Have fun with it!
Lukas
Graphics 800,600 Global ausgleich:Double Global weite:Double Global gu:Double Global ABSP:Int Global GRP:Int Global reg:Double absp = 2 grp = 2 anzahl = 50 ausgleich= 40000000 weite = 10000000000 zufweite = 500000 gu = 500000000 reg = 1 Global planets:Double[anzahl] Global planetg:Double[anzahl] Global planetx:Double[anzahl] Global planety:Double[anzahl] Global planetxs:Double[anzahl] Global planetys:Double[anzahl] Global greatest:Double[anzahl] Global greatestp:Double[anzahl] Global color:Double[anzahl] Global zoom:Double Global gesamtgroesse:Double = .1 Global verhx:Double Global verhy:Double Global xp:Double Global yp:Double xp = weite yp = weite zoom = (1/(weite/200)) Global abstandx:Double Global abstandy:Double Global abstand:Double Global richtungx:Double Global richtungy:Double Global ausgleich2:Double Global aenderungsr:Double For x = 0 To (anzahl-1) planetx[x] =Rnd (-zufweite,zufweite) planety[x] = Rnd(-zufweite,zufweite) planetg[x] = Rand(1,gu) Next Repeat For xx = 0 To (anzahl-1) SetColor 150+color[xx],150+color[xx],100 DrawOval (planetx[xx]+xp)*zoom,(planety[xx]+yp)*zoom,(planetg[xx]^0.5)*zoom+1,(planetg[xx]^0.5)*zoom+1 planetx[xx] = planetx[xx] + planetxs[xx] planety[xx] = planety[xx] + planetys[xx] color [xx] = 0 Next gesamtgroesse = 0.1 For xx3 = 0 To (anzahl-1) greatest[xx3] = 0 For yy3 = 0 To (anzahl-1) abstandx = (Abs((planetx[xx3]+(planetg[xx3]^0.5/2))-(planetx[yy3]+planetg[yy3]^0.5/2)))^2 abstandy = (Abs((planety[xx3]+(planetg[xx3]^0.5/2))-(planety[yy3]+planetg[yy3]^0.5/2)))^2 abstandx2 = (Abs(planetx[xx3]-planetx[yy3])) abstandy2 = (Abs(planety[xx3]-planety[yy3])) abstand = ((abstandx)+(abstandy))^0.5 If abstand < ((planetg[xx3]^0.5/2)+(planetg[yy3]^0.5/2)) And xx3 <>yy3 Then If planetg[xx3] >= planetg[yy3] Then planetx[xx3] = planetx[xx3] planety[xx3] = planety[xx3] Else planetx[xx3] = planetx[yy3] planety[xx3] = planety[yy3] End If planetg[xx3] = planetg[xx3]+planetg[yy3] planetg[yy3] = Rnd (1,gu*reg) planetxs[xx3] = (planetxs[xx3]+((planetg[yy3]/planetg[xx3])*planetxs[yy3]))/(1+(planetg[yy3]/planetg[xx3])) planetys[xx3] = (planetys[xx3]+((planetg[yy3]/planetg[xx3])*planetys[yy3]))/(1+(planetg[yy3]/planetg[xx3])) planetxs[yy3] = 0 planetys[yy3] = 0 planetx[yy3] = Rnd (-zufweite,zufweite) planety[yy3] = Rnd (-zufweite,zufweite) End If If xx3<>yy3 And abstandy2 <> 0 And abstandx2 <> 0 Then End If If xx3<>yy3 Then ausgleich2= (100/abstand) Else ausgleich2 = .01 End If If xx3 <> yy3 Then aenderungsr = ( (planetg[yy3]/planetg[xx3])^grp*ausgleich*(1/abstand^absp)) Else aenderungsr = 0 End If richtungx = Sin((abstandx^0.5)/(abstandy^0.5)) richtungy = Cos((abstandy^0.5)/(abstandx^0.5)) richtungx = 1 richtungy = 1 If (planetx[xx3]+planetg[xx3]^0.5/2) < (planetx[yy3]+planetg[yy3]^0.5/2) And xx3<>yy3 Then planetxs[xx3] = (planetxs[xx3] + (aenderungsr*richtungx) ) Else planetxs[xx3] = (planetxs[xx3] - (aenderungsr*richtungx)) End If If (planety[xx3]+planetg[xx3]^0.5/2) < (planety[yy3]+planetg[yy3]^0.5/2) Then planetys[xx3] = (planetys[xx3] + (aenderungsr*richtungy)) Else planetys[xx3] = (planetys[xx3] - (aenderungsr*richtungy)) End If If aenderungsr > greatest[xx3] Then greatest[xx3] = aenderungsr greatestp[xx3] = yy3 color[yy3] = color [yy3] + (100/anzahl) EndIf If KeyDown (key_space) Then SetColor 255,0,0 verhx = (planetxs[xx3]/planetys[xx3]) verhy =(planetys[xx3]/planetxs[xx3]) DrawLine (planetx[xx3]+xp)*zoom,(planety[xx3]+yp)*zoom,(planetx[xx3]+planetxs[xx3]+xp)*zoom,(planety[xx3]+planetys[xx3]+yp)*zoom End If gesamtgroesse = gesamtgroesse + planetg[yy3] If planetx[xx3] > weite Then planetxs[xx3] = -1 planetx[xx3] = weite End If If planetx[xx3] < -weite Then planetxs[xx3] = 1 planetx[xx3] = -weite End If If planety[xx3] > weite Then planetys[xx3] = -1 planety[xx3] = weite End If If planety[xx3] < -weite Then planetys[xx3] = 1 planety[xx3] = -weite End If Next Next If KeyDown (key_g) Then For xx4 = 0 To (anzahl-1) For yy4 = 0 To (anzahl-1) SetColor 0,255,0 DrawLine (planetx[xx4]+(planetg[xx4]^0.5/2)+xp)*zoom,(planety[xx4]+(planetg[xx4]^0.5/2)+yp)*zoom,(planetx[greatestp[xx4]]+(planetg[greatestp[xx4]]^0.5/2)+xp)*zoom,(planety[greatestp[xx4]]+(planetg[greatestp[xx4]]^0.5/2)+yp)*zoom Next Next End If SetColor 255,0,0 DrawLine (xp-weite)*zoom,(yp-weite)*zoom,(weite+xp)*zoom,(yp-weite)*zoom DrawLine (xp+weite)*zoom,(yp-weite)*zoom,(weite+xp)*zoom,(yp+weite)*zoom DrawLine (xp+weite)*zoom,(yp+weite)*zoom,(xp-weite)*zoom,(yp+weite)*zoom DrawLine (xp-weite)*zoom,(yp+weite)*zoom,(xp-weite)*zoom,(yp-weite)*zoom Flip Cls If KeyDown (Key_up) Then yp = yp + (5*1/zoom) End If If KeyDown (Key_down) Then yp = yp - (5*1/zoom) End If If KeyDown (Key_right) Then xp = xp - (5*1/zoom) End If If KeyDown (Key_left) Then xp = xp + (5*1/zoom) End If If KeyDown(key_a) Then zoom = zoom*.99 xp = xp + (4*1/zoom) yp = yp + (3*1/zoom) End If If KeyDown(key_s) Then zoom = zoom*1.01 xp = xp - (4*1/zoom) yp = yp - (3*1/zoom) End If DrawRect 400,296,1,9 DrawRect 396,300,9,1 If Not KeyDown(key_right) And Not KeyDown(key_left) And Not KeyDown(key_up) And Not KeyDown (key_down) Then SetColor 50,50,200 Else SetColor 50,50,255 End If DrawText "CursorKeys: Move camera",10,10 If Not KeyDown(key_s) Then SetColor 50,50,200 Else SetColor 50,50,255 End If DrawText "S: Zoom in",10,25 If Not KeyDown(key_a) Then SetColor 50,50,200 Else SetColor 50,50,255 End If DrawText "A: Zoom out",10,40 If Not KeyDown(key_space) Then SetColor 50,50,200 Else SetColor 50,50,255 End If DrawText "Space: Show planet direction",10,55 If Not KeyDown(key_g) Then SetColor 50,50,200 Else SetColor 50,50,255 End If DrawText "G:Show most important gravity connections",10,70 Until KeyHit (key_escape) End
Have fun with it!
Lukas