Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ASCII cube
#4
Here are some real Ascii Cubes:
Code: (Select All)
_Title "Ansii Cubes" 'bplus 2023-11-06

Screen _NewImage(1200, 700, 32)
_ScreenMove 50, 30
Randomize Timer
Do
    Color &HFF000000, 0
    Cls
    crates = Int(Rnd * 7) + 1
    For i = 1 To crates
        rc~& = _RGB32(Rnd * 125 + 55, Rnd * 125 + 55, Rnd * 125 + 55)
        rx = Rnd * _Width \ 8
        ry = Rnd * _Height \ 16
        rw = Int(Rnd * 31) + 5
        rh = Int(Rnd * 21) + 5
        rd = Int(Rnd * 11) + 5
        cube rx, ry, rw, rh, rd, rc~&
    Next
    Sleep
Loop Until _KeyDown(27)

Sub cube (x, y, w, h, deep, bcolor~&)
    'x, y in char cells is top RIGHT Corner
    ' so width w goes LEFT, height h goes down, deep goes up and right
    Color , bcolor~& ' front side
    char$ = Chr$(65 + Int(Rnd * 26))
    For yy = y To y + h
        For xx = x To x - w Step -1
            If xx * 8 > 0 And xx * 8 < _Width Then
                If yy * 16 > 0 And yy * 16 < _Height Then
                    Locate yy, xx: Print char$;
                End If
            End If
        Next
    Next
    Color , bcolor~& + _RGB32(25, 25, 25) ' right side
    For xx = x To x + deep
        For yy = y To y + h
            If (xx + 1) * 8 > 0 And (xx + 1) * 8 < _Width Then
                If (yy - i) * 16 > 0 And yy * 16 < _Height Then
                    Locate yy - i, xx + 1: Print "|";
                End If
            End If
        Next
        i = i + 1
    Next
    Color , bcolor~& + _RGB32(50, 50, 50)
    i = 0
    For yy = y - 1 To y - deep Step -1 ' topside
        For xx = x + 1 To x - w Step -1
            If (xx + i) * 8 > 0 And (xx + i) * 8 < _Width Then
                If yy * 16 > 0 And yy * 16 < _Height Then
                    Locate yy, xx + i: Print "-";
                End If
            End If
        Next
        i = i + 1
    Next
End Sub


Attached Files Image(s)
   
b = b + ...
Reply


Messages In This Thread
ASCII cube - by DANILIN - 11-05-2023, 06:29 AM
RE: ASCII cube - by DANILIN - 11-05-2023, 04:05 PM
RE: ASCII cube - by bplus - 11-05-2023, 08:03 PM
RE: ASCII cube - by bplus - 11-06-2023, 07:37 PM
RE: ASCII cube - by mnrvovrfc - 11-06-2023, 11:19 PM
RE: ASCII cube - by bplus - 11-07-2023, 12:49 AM
RE: ASCII cube - by bplus - 11-07-2023, 01:06 AM



Users browsing this thread: 8 Guest(s)