Hexagons and stuff
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 9445
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Hexagons and stuff
I was playing Hexago Continuo with my nephew last night (one of those "Richmond as Evil Uncle" evenings).
- -
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:
- -
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.
-
- -
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:
- -
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.
-
-
- Livecode Opensource Backer
- Posts: 9445
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Hexagons and stuff
AND here I am, this morning, explaining to some kids about Hexago Continuo and, accidentally on purpose , 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 . . .
- -
and (y/x) = 1,73684
-
- Livecode Opensource Backer
- Posts: 9445
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
-
- Livecode Opensource Backer
- Posts: 9445
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Hexagons and stuff
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:
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.
- - - -
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.
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"
This, however, is useful: https://rechneronline.de/pi/hexagon.php
although it does not give one a hexagon's points.
- - - -
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.
-
- Livecode Opensource Backer
- Posts: 9445
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Hexagons and stuff
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.
-
- Livecode Opensource Backer
- Posts: 9445
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Hexagons and stuff
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:
- - -
that's my BBC Master Compact having a break on the right hand side.
-
IF only things were as simple as in BBC BASIC (screen shot from a BBC Model B I have in my school:
- - -
that's my BBC Master Compact having a break on the right hand side.
-
- Livecode Opensource Backer
- Posts: 9445
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Hexagons and stuff
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,
- -
rather than a set of equal sized polygons spread across a card at equal intervals,
- -
and I jalouse full well why Kevin and Co. did not bother to include that in LiveCode.
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,
- -
rather than a set of equal sized polygons spread across a card at equal intervals,
- -
and I jalouse full well why Kevin and Co. did not bother to include that in LiveCode.
Re: Hexagons and stuff
Creating a "Regular Polygon Graphic" and setting its "polySides" to 6 does not work for you?
-
- Livecode Opensource Backer
- Posts: 9445
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Hexagons and stuff
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:Creating a "Regular Polygon Graphic" and setting its "polySides" to 6 does not work for you?
1. They are not readily tileable.
2. It is not at all easy to work out the exact locations of their 6 points.
-
- Livecode Opensource Backer
- Posts: 9445
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Hexagons and stuff
I created a simple hexagonal grid using TurtleArt: http://wiki.sugarlabs.org/go/Activities/Turtle_Art
- -
I know: don't laugh.
and exported the resultant hex grid as an SVG file which LiveCode seemed unable to import even with this:
- -
even though I opened the original SVG file in Inkscape and re-saved it.
- -
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.
- -
I know: don't laugh.
and exported the resultant hex grid as an SVG file which LiveCode seemed unable to import even with this:
- -
even though I opened the original SVG file in Inkscape and re-saved it.
- -
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.
Re: Hexagons and stuff
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
This property is read-only however!
Best
Klaus
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
This property is read-only however!
Best
Klaus
-
- Livecode Opensource Backer
- Posts: 9445
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Hexagons and stuff
Well, Ja . . .put the effective points of grc "the hex thingie"
- -
but the problem lies in the fact that those points are read-only:
one cannot adjust them so as to effect efficient tiling.
-
- Livecode Opensource Backer
- Posts: 9445
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Hexagons and stuff
So . . .
I did have to end up with a pupil who wants to make a hexagonal tiling game in LiveCode,
didn't I?
And, in theory, at least, that's very groovy indeed,
until, that is, you also find out that he's such a pain-in-the-bum he wants to make his own hexagonal tiles . . .
Now, making square and/or rectangular tiles is easy-peasy:
1. Import your map image.
2. Lay lots of rectangular graphic objects on your map.
3. Write some code:
and, magically, you have a load of tiling images.
So . . . I told this chap (his name is Kamen) that I'd "work on it over the weekend" . . .
another one to add to all the other things teachers tell pupils when they don't know
how to do things.
Of course this:
- - --
Of course I could just download and use this: https://thorbjorn.itch.io/tiled
but that spoils the fun.
I did have to end up with a pupil who wants to make a hexagonal tiling game in LiveCode,
didn't I?
And, in theory, at least, that's very groovy indeed,
until, that is, you also find out that he's such a pain-in-the-bum he wants to make his own hexagonal tiles . . .
Now, making square and/or rectangular tiles is easy-peasy:
1. Import your map image.
2. Lay lots of rectangular graphic objects on your map.
3. Write some code:
Code: Select all
on mouseUp
import snapshot from rect (the rect of grc "yourSquare") of card "yourCard"
end mouseUp
So . . . I told this chap (his name is Kamen) that I'd "work on it over the weekend" . . .
another one to add to all the other things teachers tell pupils when they don't know
how to do things.
Of course this:
made a right "Hot Fudge Sundae" of things, and this:on mouseUp
import snapshot from rect (the rect of grc "yourHexagon") of card "yourCard"
end mouseUp
just threw a blue meanie.on mouseUp
import snapshot from rect (the effective points of grc "yourHexagon") of card "yourCard"
end mouseUp
- - --
Of course I could just download and use this: https://thorbjorn.itch.io/tiled
but that spoils the fun.
Re: Hexagons and stuff
Probably something along the lines of creating a square mask image that only shows the hex tile area and then screen shot that area. Then as you move across the image you will capture the tiles you need and can set the margins as transparent. Just need to do the math to position the captures correctly.
Brian Milby
Script Tracker https://github.com/bwmilby/scriptTracker
Script Tracker https://github.com/bwmilby/scriptTracker
-
- Livecode Opensource Backer
- Posts: 9445
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Hexagons and stuff
Part of the problem is that one cannot do this:
(pseudocode)
export snapshot from stack "myStack" to file "snap.png" as PNG
as one can easily manipulate which parts of a map are visible using windowShape.
(pseudocode)
export snapshot from stack "myStack" to file "snap.png" as PNG
as one can easily manipulate which parts of a map are visible using windowShape.