Pentominoes

Creating Games? Developing something for fun?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

FredBeck
Posts: 76
Joined: Fri Nov 01, 2013 3:07 pm
Location: Paris
Contact:

Re: Pentominoes

Post by FredBeck » Wed Feb 04, 2015 10:14 am

Hi Richmond,
If you use a button with an icon instead of the image itself you won't have that rotation problem as the icon is automatically centred, however you need to resize and reposition the button.
In the button's script :

Code: Select all

on rotateMyIcon pAngle
   lock screen
   put the long id of image ID (the icon of me) into tIconID
   set the angle of tIconID to pAngle
   put the loc of  me into tCenter
   set the height of me to the height of tIconID
   set the width of me to the width of tIconID
   set the loc of  me to tCenter
   unlock screen
end rotateMyIcon 
does work nicely.
As for threshold, I never had any issue with it... What was the bug?

F.

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

Re: Pentominoes

Post by richmond62 » Wed Feb 04, 2015 7:35 pm

Thanks, Fred.

First of all; I didn't have a problem with rotation beyond the slight annoyance that I had to ensure every non-squre image is enclosed in a suqare, transparent frame.

Secondly: I am still falling foul of an intersect problem:

on mouseUp
if intersect (img "MASQ", img "I", "pixels") then
move group "SI" to 100,450
end if
if intersect (img "Z", img "I") then
move group "SI" to 100,450
end if
end mouseUp


I suspect this is because "MASQ" has been made using GIMP, and the transparent
layer has possibly been compromised on import into Livecode.

the code asking whether img "I" and img "Z" intersect work; probably because both "I" and "Z",
with their transparent areas were entirely made within Livecode.

I shall attempt to verify this by reconstructing "MASQ" entirely within Livecode and
revert to this posting on that directly.

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

Re: Pentominoes

Post by richmond62 » Wed Feb 04, 2015 8:09 pm

Oddly enough !!!! as soon as I removed "pixels" everything worked 'Hunky-Dory':

on mouseUp
if intersect (img "MASQ", img "I") then
move group "SI" to 100,450
end if
if intersect (img "Z", img "I") then
move group "SI" to 100,450
end if
end mouseUp

But, then, of course, the group moves even when it is inwith the transparent area
of image "MASQ".

Using "opaque pixels" works for image "MASQ", at which point the intersect code
for image "I" stops working: so they are, somehow, interfering with each other.

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

Re: Pentominoes

Post by richmond62 » Wed Feb 04, 2015 8:18 pm

I am beginning to suspet the problem lies in the fact that both image "I" and image "Z" are contained in groups.

FredBeck
Posts: 76
Joined: Fri Nov 01, 2013 3:07 pm
Location: Paris
Contact:

Re: Pentominoes

Post by FredBeck » Thu Feb 05, 2015 10:03 am

First of all; I didn't have a problem with rotation beyond the slight annoyance that I had to ensure every non-squre image is enclosed in a suqare, transparent frame.
I think that's very annoying! Especially if you can't control precisely the alpha channel :)
I don't see how the images being in different groups would matter, except if you don't give the correct control IDs.
If you use a button with an icon instead of the image itself you won't have that rotation problem
In fact, if you use a button with an icon instead of the image itself, you'll avoid a lot of other small issues. Plus, it's easier to change the theme of your app and highlight stuff.
For example you could set the hiliteIcon to an image representing the puzzle piece slightly lifted up with a nice transparent drop shadow (in which case you can't use opaque pixels).
Interesting point, I don't know whether it's preferable to use native lc graphics or images or what's the impact of fancy shadows and blending regarding performance.

Post Reply

Return to “Creating Games”