Page 2 of 2
Re: Pentominoes
Posted: Wed Feb 04, 2015 10:14 am
by FredBeck
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.
Re: Pentominoes
Posted: Wed Feb 04, 2015 7:35 pm
by richmond62
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.
Re: Pentominoes
Posted: Wed Feb 04, 2015 8:09 pm
by richmond62
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.
Re: Pentominoes
Posted: Wed Feb 04, 2015 8:18 pm
by richmond62
I am beginning to suspet the problem lies in the fact that both image "I" and image "Z" are contained in groups.
Re: Pentominoes
Posted: Thu Feb 05, 2015 10:03 am
by FredBeck
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.