Hexagons and stuff

Creating Games? Developing something for fun?

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2507
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Hexagons and stuff

Post by richmond62 » Thu Jun 28, 2018 8:34 am

I was playing Hexago Continuo with my nephew last night (one of those "Richmond as Evil Uncle" evenings).
-
hexago2.jpg
-
In this game one can score by matching: colour-to-colour, number-to-number, colour-&-number-to-colour-&-number: generally a "big b*gg*r of a game".
-
Whether my headache this morning is from Hexago Continuo or the white wine is another question.

But I digress.

Having put "Twinkle Toes" to bed, I sat down in front of the computer and made this:
-
hexTest4.png
-
Which is something of a half-cock job as it only copes with rotation and
colours (using 7 custom properties).

IFF you wanted to go the whole hog, you'd have to make 36 cards,
each with different colour combinations, and different number
combinations, and 14 custom properties to keep track of them all.
-
hexTest 4.livecode.zip
Here's the stack.
(4.72 KiB) Downloaded 5 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2507
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Hexagons and stuff

Post by richmond62 » Thu Jun 28, 2018 8:58 am

hexChess.jpg
-
AND here I am, this morning, explaining to some kids about Hexago Continuo and, accidentally on purpose 8), I put the pieces on top of a home made hexagonal chess board I made about 30 years ago.
-
So we started worrying about moving things between hexagons . . .
-
dd.png
dd.png (7.63 KiB) Viewed 568 times
-
and (y/x) = 1,73684 :D

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2507
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Hexagons and stuff

Post by richmond62 » Thu Jun 28, 2018 10:58 am

hex-apothem.png
hex-apothem.png (4.88 KiB) Viewed 559 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2507
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Hexagons and stuff

Post by richmond62 » Wed Jul 04, 2018 4:35 pm

Now the above is all rather charming, but . . .

The "sensible thing" would, surely, be to populate the Points list (pairs of comma delimited numbers)
with the points of a hexagonal grid?

AND, prior to that, simply to generate a hexagon with the Polygon Graphic object
(rather than the pointless, literally as well as figuratively, the Regular Polygon Graphic) by setting its points?

If one does this sort of thing:

Code: Select all

put the points of grc "RegPolygonGraphic" into fld "fPOINTS"
one gets nothing: so that is NBG!

This, however, is useful: https://rechneronline.de/pi/hexagon.php
although it does not give one a hexagon's points.
-
SALAD.png
-
HEXAGON.png
-
hex builder.livecode.zip
Here's the stack.
(1.46 KiB) Downloaded 2 times
-
This had to be built using LiveCode 7.1.4 because the LiveCode developers did NOT sort out a bug with the display of Polygon Graphics before they released their "Final" version of the LC * sequence.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2507
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Hexagons and stuff

Post by richmond62 » Wed Jul 04, 2018 5:53 pm

One of the complications with hexagons is that, while with rectangular objects you can refer to their topleft, bottomleft, topright and bottomright, you cannot refer to those and the midleft and midright of a hexagon in LiveCode.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2507
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Hexagons and stuff

Post by richmond62 » Wed Jul 04, 2018 6:01 pm

How DOES one generate a hexagon in LiveCode that measures, say, 60 pixels on each of its 6 sides?
-
IF only things were as simple as in BBC BASIC (screen shot from a BBC Model B I have in my school:
-
BBC Basic.png
BBC Basic.png (5.5 KiB) Viewed 414 times
-
Beebs.jpg
-
that's my BBC Master Compact having a break on the right hand side.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2507
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Hexagons and stuff

Post by richmond62 » Wed Jul 04, 2018 7:07 pm

I started getting all excited about multiSpace in HyperCard,
but after a side-trip to my trusty G5 iMac I was sorely disappointed as it produced
a series of ever-decreasing nested hexagons like a set of матриошки that left me gae scunnert,
-
multiSpace.png
-
rather than a set of equal sized polygons spread across a card at equal intervals,
-
bultitude.png
-
and I jalouse full well why Kevin and Co. did not bother to include that in LiveCode.

Klaus
Posts: 10105
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Hexagons and stuff

Post by Klaus » Wed Jul 04, 2018 7:36 pm

Creating a "Regular Polygon Graphic" and setting its "polySides" to 6 does not work for you?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2507
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Hexagons and stuff

Post by richmond62 » Wed Jul 04, 2018 7:48 pm

Creating a "Regular Polygon Graphic" and setting its "polySides" to 6 does not work for you?
I have had the "odd stupid moment", but not quite that bad. Creating a hexagon the way you suggest is all very fine as far as it goes, in that it creates hexagonal graphic controls. But:

1. They are not readily tileable.

2. It is not at all easy to work out the exact locations of their 6 points.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2507
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Hexagons and stuff

Post by richmond62 » Wed Jul 04, 2018 7:56 pm

I created a simple hexagonal grid using TurtleArt: http://wiki.sugarlabs.org/go/Activities/Turtle_Art
-
hexes.png
-
I know: don't laugh. 8)

and exported the resultant hex grid as an SVG file which LiveCode seemed unable to import even with this:
-
SVG Importer.livecode.zip
Richmond's SVG fudger.
(87.19 KiB) Downloaded 4 times
-
even though I opened the original SVG file in Inkscape and re-saved it.
-
hexes.svg.zip
hex grid exported from TurtleArt.
(916 Bytes) Downloaded 2 times
-
I suppose I could have processed it into a PNG image and imported that,
but that would also have been a bit useless re Mathematics.
Last edited by richmond62 on Wed Jul 04, 2018 8:10 pm, edited 2 times in total.

Klaus
Posts: 10105
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Hexagons and stuff

Post by Klaus » Wed Jul 04, 2018 7:56 pm

Hi RIchmond,

1. what does that mean exactly?
Will make manual adjustments neccessary, if that is what you mean.

2.
...
put the effective points of grc "the hex thingie"
...
Could be helpful here :D
This property is read-only however!


Best

Klaus

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2507
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Hexagons and stuff

Post by richmond62 » Wed Jul 04, 2018 8:04 pm

put the effective points of grc "the hex thingie"
Well, Ja . . .
-
effectPts.png
-
but the problem lies in the fact that those points are read-only:
one cannot adjust them so as to effect efficient tiling.

Post Reply

Return to “Creating Games”