Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A Little Challenge: Spin the Circle
#5
And here's another flip the coin type demo I dug up:

Code: (Select All)
'Flip The Coin - By SierraKen
'Made on July 16, 2020.
'Thanks to Dav for the ring around the coin idea.

Screen _NewImage(800, 600, 32)
_Title "Left Click the coin to flip it in the air. Right Click the coin to spin it."
_Limit 100
Cls
x = 400: y = 450
For sz = .25 To 40 Step .25
    Circle (x, y), sz, _RGB32(0, 100, 0)
Next sz
Circle (x, y), 41, _RGB32(0, 255, 0)
'Building
Line (380, 440)-(420, 455), _RGB32(0, 255, 0), B
Line (380, 455)-(370, 465), _RGB32(0, 255, 0)
Line (420, 455)-(430, 465), _RGB32(0, 255, 0)
'Stairs
For sty = 455 To 465 Step 2
    For stx = 369 To 381
        If Point(stx, sty) = _RGB32(0, 255, 0) Then
            For stx2 = stx To 430
                PSet (stx2, sty), _RGB32(0, 255, 0)
                If Point(stx2 + 1, sty) = _RGB32(0, 255, 0) Then GoTo nex:
            Next stx2
        End If
    Next stx
    nex:
Next sty
Line (370, 465)-(430, 465), _RGB32(0, 255, 0)
Line (385, 440)-(415, 435), _RGB32(0, 255, 0), B
'Columns
xc = 380
For columns = 1 To 12
    xc = xc + 3.33
    Line (xc, 440)-(xc, 455), _RGB32(0, 255, 0)
Next columns

start:
Do
    Do While _MouseInput
        mouseX = _MouseX
        mouseY = _MouseY
        mouseLeftButton = _MouseButton(1)
        mouseRightButton = _MouseButton(2)
    Loop
    If mouseRightButton Then
        If Point(mouseX, mouseY) <> _RGB32(0, 0, 0) Then mouseRightButton = 0: GoTo spin:
    End If

    If mouseLeftButton Then
        If Point(mouseX, mouseY) <> _RGB32(0, 0, 0) Then mouseLeftButton = 0: GoTo throw:
    End If
Loop

spin:

Cls
x = 400: y = 450
tt = 1
yy = 10
For cc = 1 To 2
    For c = 1 To 25
        t = t + tt
        If t > 2 Then tt = -.2
        If t < 1 Then tt = .2
        For sz = .25 To 40 Step .25
            Circle (x, y), sz, _RGB32(0, 100, 0), , , t
        Next sz
        Circle (x, y), 41, _RGB32(0, 255, 0), , , t
        x = x - yy
        _Delay .02
        Cls
    Next c
    yy = -10
Next cc
For cc = 1 To 2
    For c = 1 To 25
        t = t + tt
        If t > 2 Then tt = -.2
        If t < 1 Then tt = .2
        For sz = .25 To 40 Step .25
            Circle (x, y), sz, _RGB32(0, 100, 0), , , t
        Next sz
        Circle (x, y), 41, _RGB32(0, 255, 0), , , t
        x = x - yy
        _Delay .02
        Cls
    Next c
    yy = 10
Next cc



GoTo outcome:

throw:
Cls
x = 400: y = 450
tt = .2
yy = 10
yy2 = 1
For cc = 1 To 2
    For c = 1 To 30
        t = t + tt
        If t > 1 Then tt = -.3
        If t < .2 Then tt = .3
        For sz = .25 To 40 Step .25
            Circle (x, y), sz, _RGB32(0, 100, 0), , , t
        Next sz
        Circle (x, y), 41, _RGB32(0, 255, 0), , , t
        y = y - yy
        yy = yy + yy2
        _Delay .02
        Cls
    Next c
    yy2 = -1
    yy = -10
Next cc

'-------------- Draw the outcome -----------------

outcome:
Randomize Timer
side = Int(Rnd * 2) + 1

If side = 1 Then
    For sz = .25 To 40 Step .25
        Circle (x, y), sz, _RGB32(0, 100, 0)
    Next sz
    Circle (x, y), 41, _RGB32(0, 255, 0)
    'Head
    For sz = .25 To 20 Step .25
        Circle (400, 450), sz, _RGB32(0, 255, 0), , , 1.25
    Next sz
    'Eye
    For sz = .25 To 3 Step .25
        Circle (390, 445), sz, _RGB32(0, 100, 0)
    Next sz
    'Nose
    For sz = .25 To 5 Step .25
        Circle (382, 450), sz, _RGB32(0, 255, 0), , , .5
    Next sz
    'Mouth
    For sz = .25 To 5 Step .25
        Circle (388, 457), sz, _RGB32(0, 100, 0), , , .5
    Next sz
    'Hair
    For hy = 433 To 455 Step 3
        For hx = 400 To 420 Step 3
            If Point(hx, hy) = _RGB32(0, 255, 0) Then Circle (hx, hy), 2, _RGB32(0, 175, 0)
        Next hx
    Next hy
End If

If side = 2 Then
    For sz = .25 To 40 Step .25
        Circle (x, y), sz, _RGB32(0, 100, 0)
    Next sz
    Circle (x, y), 41, _RGB32(0, 255, 0)
    'Building
    Line (380, 440)-(420, 455), _RGB32(0, 255, 0), B
    Line (380, 455)-(370, 465), _RGB32(0, 255, 0)
    Line (420, 455)-(430, 465), _RGB32(0, 255, 0)
    'Stairs
    For sty = 455 To 465 Step 2
        For stx = 369 To 381
            If Point(stx, sty) = _RGB32(0, 255, 0) Then
                For stx2 = stx To 430
                    PSet (stx2, sty), _RGB32(0, 255, 0)
                    If Point(stx2 + 1, sty) = _RGB32(0, 255, 0) Then GoTo nex2:
                Next stx2
            End If
        Next stx
        nex2:
    Next sty
    Line (370, 465)-(430, 465), _RGB32(0, 255, 0)
    Line (385, 440)-(415, 435), _RGB32(0, 255, 0), B
    'Columns
    xc = 380
    For columns = 1 To 12
        xc = xc + 3.33
        Line (xc, 440)-(xc, 455), _RGB32(0, 255, 0)
    Next columns
End If
GoTo start:
Reply


Messages In This Thread
A Little Challenge: Spin the Circle - by NakedApe - 09-10-2024, 10:15 PM
RE: A Little Challenge: Spin the Circle - by SMcNeill - 09-11-2024, 01:32 AM
RE: A Little Challenge: Spin the Circle - by Dav - 09-12-2024, 11:44 PM



Users browsing this thread: 1 Guest(s)