QB64 Phoenix Edition
XONIX - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Programs (https://qb64phoenix.com/forum/forumdisplay.php?fid=7)
+---- Thread: XONIX (/showthread.php?tid=519)



XONIX - DANILIN - 06-04-2022

? xonix ? ... XoniX ... !!! XONIX !!!

Code: (Select All)
Randomize Timer: b = Int(Rnd * 15 + 7): a = Int(Rnd * 15 + 7) ' xonix.bas
y = Int(Rnd * (b - 3) + 3): x = Int(Rnd * (a - 3) + 3)
'b = 10: a = 20: y = 5: x = 5
If Rnd < .5 Then dx = -1 Else dx = 1
If Rnd < .5 Then dy = -1 Else dy = 1

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 100: _Delay .03: Locate y, x: Print " "
    If y + dy < 2 Or y + dy > b - 1 Then dy = -dy
    y = y + dy
    If x + dx < 2 Or x + dx > a - 1 Then dx = -dx
    x = x + dx
    Locate y, x: Print "@"
Next

qbasic qb64 xonix
gif 45 kB
   

https://en.wikipedia.org/wiki/Xonix
en.wikipedia.org/wiki/Xonix


RE: XONIX - triggered - 06-04-2022

What in the world is this?


RE: XONIX - DANILIN - 06-04-2022

I have long dreamed of creating a sketch
about a flying balloon from scratch
and created it in an hour

I suppose locals could have composed
much shorter than my program in past

Program create a random area
and in a random place ball starts and flies

There was an idea to apply "screen(y-1, x+1) =35"
however a non-optimal program would become longer

My program is universal:
creating an array of coordinates
there will be a lot of flying balls


RE: XONIX - madscijr - 06-04-2022

Wasn't Xonix the company who made those "double ender" cartridges for the Atari 2600 back in the '80s?


RE: XONIX - DANILIN - 06-04-2022

I'm a fan of ZX spectrum 48k

https://rosettacode.org/wiki/Category:ZX_Spectrum_Basic
rosettacode.org/wiki/Category:ZX_Spectrum_Basic

behind post is better:

_Font 17 ' biger
...
Color 0, RND*15
...
Color RND*15, 0


RE: XONIX - bplus - 06-04-2022

Expanding on the subject of WTH?
Code: (Select All)
_Font 8
m = 3: n = 2
restart:
_Title Str$(m) + " x" + Str$(n): Cls
x = 1: y = 1: dx = 1: dy = 1: c = 0
move:
Locate y + 1, x + 1: Print Chr$(219);
If x + dx < 1 Or x + dx > m Then dx = -dx
x = x + dx
If y + dy < 1 Or y + dy > n Then dy = -dy
y = y + dy
Color 0, 15
Locate y + 1, x + 1: Print "X";
Color 15, 0
_Limit 30
c = c + 1
If c > (m * n) Then
    toggle = 1 - toggle
    If toggle Then n = n + 2 Else m = m + 2

    _Delay 1
    GoTo restart
Else
    GoTo move
End If



RE: XONIX - vince - 06-06-2022

interesting mod, B+


RE: XONIX - DANILIN - 06-07-2022

Xonix Multi Balls

   

Animation 66 kB

Code: (Select All)
Randomize Timer: b = Int(Rnd * 10 + 15): a = Int(Rnd * 10 + 15): ' xonix135.bas
N = Int(Rnd * 5 + 3): Dim dx(N), dy(N), y(N), x(N), q$(N), c(N): _Font 17
For e = 1 To N: q$(e) = Mid$(Str$(e), 2, 1): Next ' XONIX fly color collision

For i = 1 To N
    If Rnd < .5 Then dx(i) = -1 Else dx(i) = 1
    If Rnd < .5 Then dy(i) = -1 Else dy(i) = 1
    y(i) = Int(Rnd * (b - 3) + 3): x(i) = Int(Rnd * (a - 3) + 3)
    d(i) = Int(Rnd * 4) + 1: c(i) = Int(Rnd * 5 + 1)
Next

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 y(i) + dy(i) < 2 Or y(i) + dy(i) > b - 1 Then dy(i) = -dy(i)
        y(i) = y(i) + dy(i)
        If x(i) + dx(i) < 2 Or x(i) + dx(i) > a - 1 Then dx(i) = -dx(i)
        x(i) = x(i) + dx(i)

        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


RE: XONIX - DANILIN - 09-13-2024

This XONIX theme is developing silently

and there is a smooth implementation of C#

[Image: xonixmult.gif] 133 KB

but principles of XONIX decide ... maze

DAV: MazeBall - A tilt-like maze puzzle game

https://qb64phoenix.com/forum/showthread.php?tid=2761&pid=28390#pid28390