Tree Maker
#4
I updated the original Tree Maker today to make grass, sky, leaves, and thinner branches but a larger tree. Press the Space Bar to make another random tree. 

Tell me what you think, thanks.


[Image: Tree-Maker-by-Sierra-Ken.jpg]



Code: (Select All)
'Tree Maker by SierraKen - September 3, 2022.
'Feel free to use this in any code.
'The screen cannot have _RGB32(255, 125, 127) or _RGB32(255, 127, 127) because they use that for points as a plot value.
Screen _NewImage(1000, 600, 32)
_Title "Tree Maker - Press Space Bar for another tree - Esc to end"
start:
_Limit 20
Cls
'sky
For y = 0 To 500
    blue = blue + .5
    Line (0, y)-(1000, y), _RGB32(0, 0, blue)
Next y
blue = 0
'Ground
For y = 501 To 600
    green = green + 2
    Line (0, y)-(1000, y), _RGB32(0, green, 0)
Next y
green = 0
Line (499, 500)-(501, 480), _RGB32(255, 127, 127), BF
PSet (500, 480), _RGB32(255, 125, 127)
limbsy = 490
size = 100
For stories = 1 To 6 '<<<<<<< Experiment with this number.
    size = size - 2 '<<<<<<< Experiment with this number.
    For yy = 0 To 600
        For xx = 0 To 800
            If Point(xx, yy) = _RGB32(255, 125, 127) Then
                limbsx = xx
                limbsy = yy
                seconds = (Rnd * 8) + 5
                s = (60 - seconds) * 6 + 180
                x = Int(Sin(s / 180 * 3.141592) * size) + limbsx
                y = Int(Cos(s / 180 * 3.141592) * size) + limbsy
                Line (limbsx + b, limbsy)-(x + b, y), _RGB32(255, 127, 127)
                PSet (x, y), _RGB32(255, 125, 127)
                seconds = (Rnd * 9) + 47
                s = (60 - seconds) * 6 + 180
                x = Int(Sin(s / 180 * 3.141592) * size) + limbsx
                y = Int(Cos(s / 180 * 3.141592) * size) + limbsy
                Line (limbsx, limbsy)-(x, y), _RGB32(255, 127, 127)
                PSet (x, y), _RGB32(255, 125, 127)
            End If
        Next xx
    Next yy
Next stories
For leaves = 1 To 30000
    leafx = Rnd * 800
    leafy = Rnd * 480
    If Point(leafx, leafy) = _RGB32(255, 127, 127) Then
        For sz = .25 To 4 Step .25
            Circle (leafx, leafy + 4), sz, _RGB32(0, 255, 0), , , 2.5
        Next sz
    End If

Next leaves

Do:
    _Limit 20
    a$ = InKey$
    If a$ = " " Then GoTo start:
    If a$ = Chr$(27) Then End
Loop
Reply


Messages In This Thread
Tree Maker - by SierraKen - 09-02-2022, 06:32 PM
RE: Tree Maker - by bplus - 09-02-2022, 06:50 PM
RE: Tree Maker - by SierraKen - 09-02-2022, 07:10 PM
RE: Tree Maker - by SierraKen - 09-03-2022, 07:37 PM
RE: Tree Maker - by James D Jarvis - 09-03-2022, 09:28 PM



Users browsing this thread: 1 Guest(s)