Tree Maker
#1
I know B+ has made a better one awhile back, but I've wanted to make one of these myself for years and FINALLY did it!!
It doesn't add leaves but it makes the trunk and random branches. And the land line. 
It finally came to me this morning to just use PSET color plot points and to loop it and at every loop it also scans to find those PSET color plot points. 
It's very simple if you take a look at the code and play around with it. Smile 
In the comments I added the PSET color not to use anywhere else on the screen for your own programs since that's where it needs those points. In the code I put where you can play around with other numbers on 2 lines. 

Press the Space Bar to make another random tree. 
The funny thing is, I was trying to do this yesterday but ended up making the Tesla Coil instead. Big Grin 


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



Code: (Select All)
'Tree Maker by SierraKen - September 2, 2022.
'Feel free to use this in any code.
'The screen cannot have _RGB32(255, 125, 127) because it uses that PSET point as a plot value.
Screen _NewImage(800, 600, 32)
_Title "Tree Maker - Press Space Bar for another tree - Esc to end"
start:
_Limit 20
Cls
Line (0, 500)-(800, 500), _RGB32(127, 255, 127)
Line (397, 500)-(403, 480), _RGB32(255, 127, 127), BF
PSet (400, 480), _RGB32(255, 125, 127)
limbsy = 490
size = 60
For stories = 1 To 5 '<<<<<<< Experiment with this number.
    size = size - 3 '<<<<<<< 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
                For b = 2 To -2 Step -.1
                    Line (limbsx + b, limbsy)-(x + b, y), _RGB32(255, 127, 127)
                    Line (limbsx + b, limbsy)-(x + b, y), _RGB32(255, 127, 127)
                Next b
                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
                For b = 2 To -2 Step -.1
                    Line (limbsx + b, limbsy)-(x + b, y), _RGB32(255, 127, 127)
                    Line (limbsx + b, limbsy)-(x + b, y), _RGB32(255, 127, 127)
                Next b
                PSet (x, y), _RGB32(255, 125, 127)
            End If
        Next xx
    Next yy
Next stories
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: 3 Guest(s)