### Author Topic: Halloween Reoccurence  (Read 792 times)

#### B+

• Hero Member
• Posts: 734
##### Halloween Reoccurence
« on: 31. October 2017, 04:28:10 »
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
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
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+

• Hero Member
• Posts: 734
##### Re: Halloween Reoccurence
« Reply #1 on: 01. November 2017, 02:32:49 »
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.

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: 01. November 2017, 02:38:22 by B+ »

#### Cybermonkey

• Hero Member
• Posts: 611
##### Re: Halloween Reoccurence
« Reply #2 on: 01. November 2017, 16:52:08 »
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: 01. November 2017, 16:54:49 by Cybermonkey »
Best regards,
Cybermonkey

#### ZXDunny

• Full Member
• Posts: 232
##### Re: Halloween Reoccurence
« Reply #3 on: 01. November 2017, 19:42:24 »
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+

• Hero Member
• Posts: 734
##### Re: Halloween Reoccurence
« Reply #4 on: 01. November 2017, 19:54:47 »
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: 01. November 2017, 20:03:39 by B+ »

#### Mike Lobanovsky

• Full Member
• Posts: 222
##### Re: Halloween Reoccurence
« Reply #5 on: 02. November 2017, 20:41:36 »
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).
Mike
_________________________________________________________________
(3.6GHz i5-3470, 16GB RAM / nVidia GTX 1060Ti, 6GB VRAM / x64 Win 7 Ult.)

#### Richey

• Full Member
• Posts: 208
• Oh, Zippy!
##### Re: Halloween Reoccurence
« Reply #6 on: 02. November 2017, 22:19:21 »
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: 02. November 2017, 22:22:25 by Richey »

#### ZXDunny

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

(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+

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