Stones
04-19-2001, 09:12 AM
I have in one scene pieces of a house and a pyramide that is made up of different colors.
When a person clicks on a color of the pyramide it also colors a piece of the house. The person can click the colors randomly, there is no path.
My problem is telling the pieces of the house to group together once they are all colored. Is there an action to do this. I have to tell it that if all the pieces are colored then group together.
Hi...
As I don't know what method your using to color your house pieces I'll explain every step I used to achieved the answer. If you follow my answer to the book then you'll see how it works. Just copy & paste the code directly into your actions panel:
1) Place four 'house' MC's randomly on your stage, name them house1, house2, house3 and house4. Using the info panel set the sizes to '39*39'.
2) Place four 'pyramide' pieces on your stage, name them pyramide1, pyramide2, pyramide3 and pyramide4.
3) Add the following script to each of the 'pyramides', substituting the colors and 'house' names where appropriate. I'll provide you with the first two:
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse,_root._ymouse,true)) {
a = new Color(_root.house1);
a.setRGB(0xFF0000);
_root.pyramide1 = true;
}
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse,_root._ymouse,true)) {
b = new Color(_root.house2);
b.setRGB(0xFF0000);
_root.pyramide2 = true;
}
}
The colors should match that of the 'pyramides', so when you click on the 'pyramides' the corresponding 'house' MC will match.
The true staement on the last line is there to let us know when all the 'pyramides' have been selected.
4) Finally we add a looping statement that checks to see if all the 'house' pieces have been colored, if yes then it places them in exact positions:
onClipEvent (enterFrame) {
if ( _root.pyramide1==true&&_root.pyramide2==true&&_root.pyramide3==true&&_root.pyramide4==true) {
_root.house1._x=100;
_root.house1._y=70;
_root.house2._x=141;
_root.house2._y=70;
_root.house3._x=100;
_root.house3._y=110;
_root.house4._x=141;
_root.house4._y=110;
}
}
Follow the above precisely, that way you'll see how it works.
Hope this helps.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.