Author Topic: Halloween Reoccurence  (Read 2512 times)

B+

  • Guest
Halloween Reoccurence
« on: October 31, 2017, 03:28:10 AM »
Another occurrence of another variation, kind of scary how it wont go away...

QB64 so I had to make my own ellipse and fill triangle subs.

Code: [Select]
_TITLE "Halloween Reoccurence 2017-10-29 bplus"
CONST xmax = 1100
CONST ymax = 740

SCREEN _NEWIMAGE(xmax, ymax, 32)
_SCREENMOVE 160, 2

RANDOMIZE TIMER
COMMON SHARED sx
cx = xmax / 2: cy = ymax / 2: pr = .49 * xmax
d = 1: sx = 0
WHILE 1
    pumpkin cx, cy, pr, 3
    sx = sx + rand%(-4, 4)
    IF sx > .7 * pr / 12 THEN d = -1 * d: sx = 0
    IF sx < -.7 * pr / 12 THEN d = -1 * d: sx = 0
    _DISPLAY
    _LIMIT 6
WEND

FUNCTION rand% (lo%, hi%)
    rand% = INT(RND * (hi% - lo% + 1)) + lo%
END FUNCTION

SUB pumpkin (cx, cy, pr, limit)
    'carve this!
    COLOR &HFFFF0000
    fEllipse cx, cy, pr, 29 / 35 * pr
    COLOR &HFF000000
    lastr = 2 / 7 * pr
    DO
        ellipse cx, cy, lastr, 29 / 35 * pr
        lastr = .5 * (pr - lastr) + lastr + 1 / 35 * pr
        IF pr - lastr < 1 / 80 * pr THEN EXIT DO
    LOOP

    ' 'flickering candle light
    COLOR _RGB(RND * 55 + 200, RND * 55 + 200, 120)

    ' eye sockets
    ftri cx - 9 * pr / 12, cy - 2 * pr / 12, cx - 7 * pr / 12, cy - 6 * pr / 12, cx - 3 * pr / 12, cy - 0 * pr / 12
    ftri cx - 7 * pr / 12, cy - 6 * pr / 12, cx - 3 * pr / 12, cy - 0 * pr / 12, cx - 2 * pr / 12, cy - 3 * pr / 12
    ftri cx + 9 * pr / 12, cy - 2 * pr / 12, cx + 7 * pr / 12, cy - 6 * pr / 12, cx + 3 * pr / 12, cy - 0 * pr / 12
    ftri cx + 7 * pr / 12, cy - 6 * pr / 12, cx + 3 * pr / 12, cy - 0 * pr / 12, cx + 2 * pr / 12, cy - 3 * pr / 12

    ' nose
    ftri cx, cy - rand%(2, 5) * pr / 12, cx - 2 * pr / 12, cy + 2 * pr / 12, cx + rand%(1, 2) * pr / 12, cy + 2 * pr / 12

    ' evil grin
    ftri cx - 9 * pr / 12, cy + 1 * pr / 12, cx - 7 * pr / 12, cy + 7 * pr / 12, cx - 6 * pr / 12, cy + 5 * pr / 12
    ftri cx + 9 * pr / 12, cy + 1 * pr / 12, cx + 7 * pr / 12, cy + 7 * pr / 12, cx + 6 * pr / 12, cy + 5 * pr / 12

    ' moving teeth/talk/grrrr..
    u = rand%(4, 8)
    dx = pr / u
    FOR i = 1 TO u
        tx1 = cx - 6 * pr / 12 + (i - 1) * dx
        tx2 = tx1 + .5 * dx
        tx3 = tx1 + dx
        ty1 = cy + 5 * pr / 12
        ty3 = cy + 5 * pr / 12
        ty2 = cy + (4 - RND) * pr / 12
        ty22 = cy + (6 + RND) * pr / 12
        ftri tx1, ty1, tx2, ty2, tx3, ty3
        ftri tx1 + .5 * dx, ty1, tx2 + .5 * dx, ty22, tx3 + .5 * dx, ty3
    NEXT
    IF limit THEN

        'shifty eyes
        IF limit = 3 THEN sxs = sx ELSE sxs = .1 * sx
        pumpkin sxs + cx - 5 * pr / 12, cy - 2.5 * pr / 12, .15 * pr, INT(limit - 1)
        pumpkin sxs + cx + 5 * pr / 12, cy - 2.5 * pr / 12, .15 * pr, INT(limit - 1)
    END IF
END SUB

SUB fEllipse (CX AS LONG, CY AS LONG, xRadius AS LONG, yRadius AS LONG)
    DIM scale AS SINGLE, x AS LONG, y AS LONG
    scale = yRadius / xRadius
    LINE (CX, CY - yRadius)-(CX, CY + yRadius), , BF
    FOR x = 1 TO xRadius
        y = scale * SQR(xRadius * xRadius - x * x)
        LINE (CX + x, CY - y)-(CX + x, CY + y), , BF
        LINE (CX - x, CY - y)-(CX - x, CY + y), , BF
    NEXT
END SUB

SUB ellipse (CX AS LONG, CY AS LONG, xRadius AS LONG, yRadius AS LONG)
    DIM scale AS SINGLE, xs AS LONG, x AS LONG, y AS LONG
    DIM lastx AS LONG, lasty AS LONG
    scale = yRadius / xRadius: xs = xRadius * xRadius
    PSET (CX, CY - yRadius): PSET (CX, CY + yRadius)
    lastx = 0: lasty = yRadius
    FOR x = 1 TO xRadius
        y = scale * SQR(xs - x * x)
        LINE (CX + lastx, CY - lasty)-(CX + x, CY - y)
        LINE (CX + lastx, CY + lasty)-(CX + x, CY + y)
        LINE (CX - lastx, CY - lasty)-(CX - x, CY - y)
        LINE (CX - lastx, CY + lasty)-(CX - x, CY + y)
        lastx = x: lasty = y
    NEXT
END SUB

SUB ftri (xx1, yy1, xx2, yy2, xx3, yy3)
    'make copies before swapping
    x1 = xx1: y1 = yy1: x2 = xx2: y2 = yy2: x3 = xx3: y3 = yy3
    'thanks Andy Amaya!
    'triangle coordinates must be ordered: where x1 < x2 < x3
    IF x2 < x1 THEN SWAP x1, x2: SWAP y1, y2
    IF x3 < x1 THEN SWAP x1, x3: SWAP y1, y3
    IF x3 < x2 THEN SWAP x2, x3: SWAP y2, y3
    IF x1 <> x3 THEN slope1 = (y3 - y1) / (x3 - x1)

    'draw the first half of the triangle
    length = x2 - x1
    IF length <> 0 THEN
        slope2 = (y2 - y1) / (x2 - x1)
        FOR x = 0 TO length
            LINE (INT(x + x1), INT(x * slope1 + y1))-(INT(x + x1), INT(x * slope2 + y1))
            'lastx2% = lastx%
            lastx% = INT(x + x1)
        NEXT
    END IF

    'draw the second half of the triangle
    y = length * slope1 + y1: length = x3 - x2
    IF length <> 0 THEN
        slope3 = (y3 - y2) / (x3 - x2)
        FOR x = 0 TO length
            'IF INT(x + x2) <> lastx% AND INT(x + x2) <> lastx2% THEN  'works! but need 2nd? check
            IF INT(x + x2) <> lastx% THEN
                LINE (INT(x + x2), INT(x * slope1 + y))-(INT(x + x2), INT(x * slope3 + y2))
            END IF
        NEXT
    END IF
END SUB

B+

  • Guest
Re: Halloween Reoccurence
« Reply #1 on: November 01, 2017, 01:32:49 AM »
Sorry, no screen shots. I didn't want to spoil the surprise ending.

JRS, maybe you will give us a shot?

D, feel free to Smash it after Halloween, with appropriate music of course. :D

Galileo, yes should work in YAB.

Rick3137 or Marcus, yep SdlBasic and Naalaa too!

Hi Richey, what do they do for Halloween across the pond? Anything special for teachers?

Hi Cybermonkey, and in Germany?

In the states, Halloween is second biggest holiday of year, some of the decorations are better than Christmas as far as imagination goes.

Who did I miss?

Aurel, but I hear they have Halloween every week in Croatia, so no big deal.

Mike, do you still visit?
« Last Edit: November 01, 2017, 01:38:22 AM by B+ »

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: Halloween Reoccurence
« Reply #2 on: November 01, 2017, 03:52:08 PM »
Not a big deal here in Germany. We have Carnival (usually in February), or as we call it in southern Germany: "Fasnet".



Wikipedia: https://en.wikipedia.org/wiki/Swabian-Alemannic_Fastnacht
« Last Edit: November 01, 2017, 03:54:49 PM by Cybermonkey »

ZXDunny

  • Guest
Re: Halloween Reoccurence
« Reply #3 on: November 01, 2017, 06:42:24 PM »
Round our way it's "All Hallows' Eve" when traditionally evil spirits, warlocks and witches would be knocking around up to no good. The idea was to carve a scary face in a pumpkin and light it from the inside with a candle before leaving it outside your front door - it would scare the evil away.

Now the American tradition of "Trick or Treat" has taken hold over the last few decades, and the roots of the day have been all but lost in the scramble for as much sugar as it is possible to get in a tacky bucket. Now the pumpkin is used to signal (around here at any rate) that the occupants of the house are welcoming of Trick-or-Treaters and have stashes of sweets indoors.

I love it personally, but there are a fair few that don't.

B+

  • Guest
Re: Halloween Reoccurence
« Reply #4 on: November 01, 2017, 06:54:47 PM »
Hi Cybermonkey,

Your Fasnet reminds me of New Orleans Mardi Gras.

Hi D,

Yes, feeding sugar to already overactive spirits is evil, that is the trick from a treat.


Dang it! I forgot JJ  :-[

Well maybe he doesn't go in for this child's play anyway?


Hi JJ,

How goes it with you and your part of the woods?


Oh and Peter!

Hi Peter,

I missed you too! heck, you might actually give the Re-occurrence a go at translation.


The scariest part of this whole deal is my spelling of reoccurrence.
« Last Edit: November 01, 2017, 07:03:39 PM by B+ »

Mike Lobanovsky

  • Guest
Re: Halloween Reoccurence
« Reply #5 on: November 02, 2017, 07:41:36 PM »
Mike, do you still visit?

Hi B+,

Yes, I do from time to time, though mostly lurking without actually signing in. I've been massively into old-skool rock'n'roll and related retro audio gear this year as my primary hobby, rather than into programming in BASIC. And my computers will have to wait yet a while longer. :)

We don't have anything like Halloween in our culture. But if we had, I guess it should've been the date of the Great October Socialist Revolution (well, y'know, Lenin, Stalin, bolsheviks, and stuff). ;)

Richly

  • Guest
Re: Halloween Reoccurence
« Reply #6 on: November 02, 2017, 09:19:21 PM »
Hi Richey, what do they do for Halloween across the pond? Anything special for teachers?

Hi B+

Well, Halloween has British Celtic roots and is derived from Gaelic and Welsh traditions before being later influenced and shaped by Christianity. As D says, we celebrate it pretty much the same as you do in the US with pumpkins, dunking for apples (we still do that!) and children dressing up as witches and ghouls etc. No trick-or-treaters this year though and my own daughter went to a Halloween party. Nothing special for teachers in my daughters school, although the children had a Halloween disco. Now we are looking forward to Guy Fawkes Night on 5th Nov - lots of fireworks, which I guess you don't celebrate in the US (or anywhere else except in the UK - and perhaps UK dependent territories and Commonwealth countries  :) )

https://en.wikipedia.org/wiki/Guy_Fawkes_Night


« Last Edit: November 02, 2017, 09:22:25 PM by Richey »

ZXDunny

  • Guest
Re: Halloween Reoccurence
« Reply #7 on: November 03, 2017, 12:45:33 AM »
Somehow, Richey, I can't see the American people celebrating an act of terror against a sitting government on Nov. 5th :D

(Though what we actually celebrate is one of the perpetrator's punishments which would make even the most pro-Capital-punishment states populations cringe in unison - but such is the British justice system, I suppose!)

B+

  • Guest
Re: Halloween Reoccurence
« Reply #8 on: November 03, 2017, 06:17:17 AM »
OK so too much candy = revolutions, rebellions and revolting retributions, with parades and fireworks thrown in for decoration. :D
« Last Edit: November 03, 2017, 06:20:26 AM by B+ »