View Full Version : Coloring book game
vbrown
October 2nd, 2002, 10:06 AM
Would be most grateful if anyone could help with this.
I am trying to create an effect for a game where the cursor takes the form of a paintbrush with different colors when clicked on different coloured paintpots (have started with this for two colours red and blue tho this could also probably be done better).
Then when clicked on the coloring book area, the colour will be applied to the area clicked on ie red brush makes it red, blue brush makes it blue, etc.
Not very wise in the ways of actionscript so can anyone advise?
The fla is attached.
flex
October 2nd, 2002, 10:11 AM
I can't open your fla for some reason. Get an unexpected file format.
Try http://www.permadi.com/tutorial/flash5Color/
vbrown
October 2nd, 2002, 10:16 AM
Am sending again. This is a Flash 5 mac file. Hope you can open it this time.
Thanks
flex
October 2nd, 2002, 10:20 AM
No joy. I'm running MX on a PC.
vbrown
October 2nd, 2002, 10:27 AM
This time it is MX. Sorry for the trouble. Can't think of anything else if no luck this time.
vbrown
October 2nd, 2002, 10:34 AM
dear Flex
Will try the recommended tutorial. it looks v useful. Many thanks.
flex
October 2nd, 2002, 10:44 AM
You're welcome.
pom
October 3rd, 2002, 07:44 AM
You can also check the droptarget tutorial on this site.
pom :)
vbrown
October 3rd, 2002, 08:30 AM
Thanks to the permadi.com tutorial, I now have exactly the effects I want.
Will now look at the droptarget tutorial, which also looks relevant.
Am SO appreciative of all the above advice.
:)
vbrown
October 3rd, 2002, 08:59 AM
Thanks to the permadi.com tutorial, I now have exactly the effects I want.
Will now look at the droptarget tutorial, which also looks relevant.
Am SO appreciative of all the above advice.
I just have one problem to solve now. That is to get a reset button to restore the image to black and white as when the movie first starts.
:)
pom
October 3rd, 2002, 11:42 AM
Well, you ca, setRGB as well, 0x000000 being black and 0xffffff being white.
pom :)
tosca
October 8th, 2002, 11:36 AM
Please can you advise how to reset the game by a sort of reset button, so the colors go back to white when it is clicked. I can't see how to make the areas revert, because the code which makes the areas change color is attached to buttons embedded in movie clips. The code is all adapted from the Permadi tutorial but he does'nt include any reset function.
Here is the code used, hope it makes sense.
1This is on the embedded buttons inside the painting area:
on (press) {
iColor=new Color(this);
iColor.setRGB(_root.fillColor);
delete iColor;
}
2This is the code on a button which fills the area red when it is pressed:
on (press) {
fillColor=0xFF0000
}
on (release) {
cursordrag_red._visible=1;
cursordrag_blue._visible=0;
cursordrag._visible=0;
Mouse.hide();
startDrag ("cursordrag_red");
tellTarget ("cursordrag_red") {
_x = /:_xmouse;
_y = /:_ymouse;
}
}
Iammontoya
October 8th, 2002, 11:31 PM
I would create a start function that simply resets everything to the starting state... So.. write down all your starting options (this thing is that color, that thing is this color, this goes there, that goes over there..
...then, attach the function to a button (or wherever)
Does that make sense?
tosca
October 13th, 2002, 07:28 AM
Will try this. Many thanks.
sw0bes
April 16th, 2007, 10:01 AM
I have been trying to add a reset function as well, and I've made a multidimensional array with the movie clip names, the buttons inside the movie clips names, and the "default" starting color. As of now I can get the data to be pulled from the array in my output window so I know that the array is setup correctly.
Again like tosca was concerned about, the action to change the color is on the buttons. Here is my script so far.
var fillArray:Array = new Array (new Array("bgSky", "bgGround", "body", "lights", "back", "cab", "controlStick", "frontCab", "innerCab", "bgTire",
"arms", "backTire", "backWheel", "bucket", "frontTire", "frontWheel"),
new Array("bgSky_mc", "bgGround_mc", "body_mc", "lights_mc", "back_mc", "cab_mc", "controlStick_mc",
"frontCab_mc", "innerCab_mc", "bgTire_mc","arms_mc", "backTire_mc", "backWheel_mc", "bucket_mc",
"frontTire_mc", "frontWheel_mc"),
new Array("0xFFFFFF", "0xCCCCCC","0xFFFFFF","0xFFFFFF","0xFFFFFF","0xFFFFFF","0xFFFFFF","0xFFFFFF","0xFFFFFF",
"0xFFFFFF","0xFFFFFF","0xFFFFFF","0xFFFFFF","0xFFFFFF","0xFFFFFF","0xFFFFFF"));
resetButton.onRelease = function() {
for(i=0; i<=15; i++){
var newColor:Color = Color(cLoader.fillArray[1][i].fillArray[0][i]);
cLoader.fillArray[1][i].fillArray[0][i].setRGB(fillArray[2][i]);
trace("cLoader." + fillArray[1][i] + "." + fillArray[0][i] + ".setRGB(" + fillArray[2][i] + ");");
}
}
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.