Hexagons and stuff

Creating Games? Developing something for fun?

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

bwmilby
Posts: 181
Joined: Wed Jun 07, 2017 5:37 am
Location: New Orleans, LA
Contact:

Re: Hexagons and stuff

Post by bwmilby » Sat Aug 04, 2018 6:11 pm

It worked for me.
Brian Milby

Script Tracker https://github.com/bwmilby/lc-misc/tree/master/ScriptTracker

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

Re: Hexagons and stuff

Post by richmond62 » Sat Aug 04, 2018 6:21 pm

I faked all my *******.

Depends on which picture you import.

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

Re: Hexagons and stuff

Post by richmond62 » Sun Aug 05, 2018 7:54 pm

What is wrong with this line?

Code: Select all

if (rect pLeft,pTop,pLeft+pWidth,pTop+pWidth of this card) is empty then

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

Re: Hexagons and stuff

Post by richmond62 » Sun Aug 05, 2018 8:46 pm

Aha . . .

If the imported image is bigger than the stack everything screws up.

So the stack has to be resized to take into account the size of the imported image:

Code: Select all

on mouseUp
   set the vis of img "JOY" to false
   if exists(img "map") then
      delete img "map"
      end if
  answer file "Select a file" --with filter "Web Graphics,*.jpg;*.gif;*.png"
  put it into theFilePath
  if theFilePath = EMPTY then
    exit mouseup
  end if
  import paint from file theFilePath
  set the name of the last control to "map"
  set the top of img "map" to 70
  set the left of img "map" to 70
  set the layer of img "map" to 1
  set the top of img "IMP" to -100
  put ((the height of img "map") + 140) into HITE
  put ((the width of img "map") + 140) into WIDD
  set the height of this stack to HITE
  set the width of this stack to WIDD
  set the top of this stack to 100
end mouseUp

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

Re: Hexagons and stuff

Post by richmond62 » Mon Aug 06, 2018 8:39 am

H5.png
-
Getting "somewhere", although the thing is still exporting hexagons without transparent borders:
-
r1c1.png
r1c1.png (10.59 KiB) Viewed 105 times
-
HexSplit5.livecode.zip
Here's the stack.
(70.36 KiB) Downloaded 4 times

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4506
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Hexagons and stuff

Post by jacque » Mon Aug 06, 2018 5:29 pm

richmond62 wrote:
Sun Aug 05, 2018 7:54 pm
What is wrong with this line?

Code: Select all

if (rect pLeft,pTop,pLeft+pWidth,pTop+pWidth of this card) is empty then
It doesn't make any sense and won't parse. Only containers (usually variables) can be empty. This passes a reserved word and a series of unnecessary variables. What's the goal?
If the imported image is bigger than the stack everything screws up.
That's a fairly common thing to do, though edges outside the card rect won't be visible. Is that what you mean? Another alternative is to resize the image to fit the card. That's usually less intrusive than changing the window size, depending on the usage.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Hexagons and stuff

Post by richmond62 » Mon Aug 06, 2018 5:54 pm

That's usually less intrusive than changing the window size, depending on the usage.
If you play with my latest version (choosing a biggish image) you will see that the stack resizes to accommodate the image to be sliced.

In the "gaming world", whether in terms of physical tiles on the table or the virtual equivalent, it is
fairly common to have vast maps made up of tiles.
-
carc.jpg
-
So one has to either put up with this or shift the image import and slicing off onto a substack and
hide it from the end-user's view.

http://flagsofvictory.blogspot.com/2014 ... n-out.html
-
Arras Map v2.jpg

Post Reply

Return to “Creating Games”