### Author Topic: A rotating paperclip.  (Read 234 times)

#### TylerDarko

• Newbie
• Posts: 40
##### A rotating paperclip.
« on: April 11, 2018, 11:15:12 am »
Code: [Select]
`SCREEN _NEWIMAGE(400, 400, 32)paperClip\$ = "s16 d10g3h3u12r8d16g5h5u15"_MOUSEHIDEDO    a! = a! + .05    IF a! > _PI(2) THEN a! = a! - _PI(2)    CLS    WHILE _MOUSEINPUT: WEND    DRAW "bm" + STR\$(_MOUSEX) + "," + STR\$(_MOUSEY)    DRAW "TA" + STR\$(_R2D(a!))    DRAW paperClip\$    _DISPLAY    _LIMIT 30LOOP UNTIL _KEYHIT_MOUSESHOW`

#### Petr

• Hero Member
• Posts: 656
##### Re: A rotating paperclip.
« Reply #1 on: April 11, 2018, 12:36:49 pm »
Nice!
Coding is relax.

#### bplus

• Hero Member
• Posts: 756
• B = B + _
##### Re: A rotating paperclip.
« Reply #2 on: April 11, 2018, 09:13:38 pm »
I turned my paper clip into a direction pointer!
Code: [Select]
`_TITLE "Mouse Direction Pointer"SCREEN _NEWIMAGE(800, 600, 32)_SCREENMOVE 100, 100' move mouse up, down, left, right or one diagonal corner to the other'Directions are in Degrees that increase going Counterclockwise with Y axis increasing going UP (like a math graph)' 0 Degrees due East, 90 Degrees due North, 180 Degrees due West, 270 Degrees SouthpaperClip\$ = "s16 d10g3h3u12r8d16g5h5u15"_MOUSEHIDEDO    'a! = a! + .05    'IF a! > _PI(2) THEN a! = a! - _PI(2)    'CLS    WHILE _MOUSEINPUT: WEND    mx = _MOUSEX: my = _MOUSEY    IF mx <> lastx OR my <> lasty THEN        CLS        a = _R2D(_ATAN2(my - lasty, lastx - mx) + _PI(3 / 2)) '?????????????? but it works!!!!  flips y axis        lastx = mx: lasty = my        DRAW "bm" + STR\$(_MOUSEX) + "," + STR\$(_MOUSEY)        DRAW "TA" + STR\$(a)        DRAW paperClip\$        IF INT(a) - 90 >= 360 THEN s\$ = STR\$(INT(a) - 90 - 360) ELSE s\$ = STR\$(INT(a) - 90)        _PRINTSTRING (10, 10), s\$    END IF    _DISPLAY    _LIMIT 30LOOP UNTIL _KEYHIT_MOUSESHOW`
« Last Edit: April 11, 2018, 09:39:35 pm by bplus »
Will you still love me, will you still need me, when I'm (QB) 64?

#### bplus

• Hero Member
• Posts: 756
• B = B + _
##### Re: A rotating paperclip.
« Reply #3 on: April 11, 2018, 10:05:05 pm »
Now that I have paper clips pointed right here are some more:
Code: [Select]
`_TITLE "Rotating Paperclips started by TylerDarko mod by B+ 2018-04-11"SCREEN _NEWIMAGE(1200, 720, 32)_SCREENMOVE 100, 20TYPE paperclip    x AS INTEGER    y AS INTEGER    a AS INTEGER    c AS LONG    s AS INTEGER    ds AS INTEGEREND TYPEmaxClips = 100currentI = 1DIM SHARED pc(maxClips) AS papercliplastx = 600lasty = 360DO    CLS    FOR i = 1 TO maxClips        drawPaperClip (i)    NEXT    WHILE _MOUSEINPUT: WEND    mx = _MOUSEX: my = _MOUSEY    IF currentI + 1 < maxClips THEN currentI = currentI + 1 ELSE currentI = 1    IF ((lastx - mx) ^ 2 + (lasty - my) ^ 2) ^ .5 > 50 THEN        a = _R2D(_ATAN2(my - lasty, lastx - mx) + _PI(3 / 2)) '?????????????? but it works!!!!  flips y axis        newPaperClip currentI, mx, my, a        lastx = mx: lasty = my    END IF    _DISPLAY    _LIMIT 30LOOP UNTIL _KEYHITSUB newPaperClip (i, x, y, a)    pc(i).x = x    pc(i).y = y    pc(i).c = _RGB32(RND * 200 + 55, RND * 200 + 55, RND * 200 + 55)    pc(i).s = 2    pc(i).a = a    pc(i).ds = 1END SUBSUB drawPaperClip (i)    DRAW "C " + STR\$(pc(i).c)    DRAW "bm" + STR\$(pc(i).x) + "," + STR\$(pc(i).y) 'move    DRAW "TA" + STR\$(pc(i).a) 'turn    DRAW "s" + STR\$(pc(i).s)    DRAW "d10g3h3u12r8d16g5h5u15"    IF pc(i).s + pc(i).ds > 60 THEN pc(i).s = 0: pc(i).ds = 0    pc(i).s = pc(i).s + pc(i).dsEND SUB`
Will you still love me, will you still need me, when I'm (QB) 64?

#### TylerDarko

• Newbie
• Posts: 40
##### Re: A rotating paperclip.
« Reply #4 on: April 12, 2018, 06:39:19 am »
Trippy.

#### Ashish

• Hero Member
• Posts: 604
• Eat.... Sleep.... CODE.... Repeat.....
##### Re: A rotating paperclip.
« Reply #5 on: April 15, 2018, 07:29:07 am »
Nice work TylerDarko and nice mods bplus!
if (Me.Success) {Me.Improve();} else {Me.TryAgain();}

aKFrameWork - http://bit.ly/aKFrameWork
p5js.bas - http://bit.ly/p5jsbas