Xonix Multi Balls
Animation 66 kB
If balls are collision: both balls change colors
Animation 66 kB
Code: (Select All)
Randomize Timer: b = Int(Rnd*10+15): a = Int(Rnd*10+15): ' xonixMAS.bas
N = Int(Rnd*5+3): Dim d(N), y(N), x(N), q$(N), c(N): _Font 17
For e = 1 To N: q$(e) = Mid$(Str$(e), 2, 1): Next
For i = 1 To N
y(i) = Int(Rnd*(b - 3)+3): x(i) = Int(Rnd*(a - 3)+3): d = Int(Rnd*4+1)
d(i) = Int(Rnd*4)+1: c(i) = Int(Rnd*5+1)
Next 'y(i)=5: x(i)=5: b=10: a=20: d=1 ' xonix.bas DANILIN
For i = 1 To a: Print "#";: Next: Print ' area
For j = 1 To b - 2: Print "#";: For k = 1 To a - 2: Print ".";: Next: Print "#": Next
For i = 1 To a: Print "#";: Next
For q = 1 To 1000: _Delay .08:
For i = 1 To N: Locate y(i), x(i): Print " "
If d(i)=1 Then If (y(i)-1=1) And (x(i)+1=a) Then d(i)=3
If d(i)=1 Then If (y(i)-1>1) And (x(i)+1=a) Then d(i)=4
If d(i)=1 Then If (y(i)-1=1) And (x(i)+1<a) Then d(i)=2
If d(i)=1 Then y(i)=y(i)-0.5*(1+i mod 2): x(i)=x(i)+0.5*(1+i mod 2)
If d(i)=2 Then If (y(i)+1=b) And (x(i)+1=a) Then d(i)=4
If d(i)=2 Then If (y(i)+1<b) And (x(i)+1=a) Then d(i)=3
If d(i)=2 Then If (y(i)+1=b) And (x(i)+1<a) Then d(i)=1
If d(i)=2 Then y(i)=y(i)+0.5*(1+i mod 2): x(i)=x(i)+0.5*(1+i mod 2)
If d(i)=3 Then If (y(i)+1=b) And (x(i)-1=1) Then d(i)=1
If d(i)=3 Then If (y(i)+1<b) And (x(i)-1=1) Then d(i)=2
If d(i)=3 Then If (y(i)+1=b) And (x(i)-1>1) Then d(i)=4
If d(i)=3 Then y(i)=y(i)+0.5*(1+i mod 2): x(i)=x(i)-0.5*(1+i mod 2)
If d(i)=4 Then If (y(i)-1=1) And (x(i)-1=1) Then d(i)=2
If d(i)=4 Then If (y(i)-1>1) And (x(i)-1=1) Then d(i)=1
If d(i)=4 Then If (y(i)-1=1) And (x(i)-1>1) Then d(i)=3
If d(i)=4 Then y(i)=y(i)-0.5*(1+i mod 2): x(i)=x(i)-0.5*(1+i mod 2)
For k=1 To N-1: For m=k+1 To N
If y(k)=y(m) And x(k)=x(m) Then c(k)=Int(Rnd*5+1):c(m)=Int(Rnd*5+1)
Next: Next
Locate y(i), x(i): Color c(i): Print q$(i): Next
Next
If balls are collision: both balls change colors
Write name of program in 1st line to copy & paste & save filename.bas
Insert program pictures: press print-screen-shot button
Open paint & Paste & Save as PNG
Add picture file to program topic
Russia looks world from future. Big data is peace data.
I never recommend anything & always write only about myself
Insert program pictures: press print-screen-shot button
Open paint & Paste & Save as PNG
Add picture file to program topic
Russia looks world from future. Big data is peace data.
I never recommend anything & always write only about myself