Hi, I am new to Scratch and am having trouble with a project. In my game when you click a leaf on a tree it turns brown, when they all turn brown all the leaves fall. I've made the leaves individual sprites and made them change color but I can't figure out how to make all the leaves fall when they all change color. Can someone help?
Thanks,
Owen
Offline
I'd make a variable called
(LeavesClicked).
When [Leaf] clicked //When a leaf is clicked, If <(Costume #) = [Greenleaf] //If the current costume is the Green leaf, Switch to costume [BrownLeaf v] Change (LeavesClicked) by (1) End
Then, you only need to do this for one leaf:
When gf clicked Forever //Always check for, (and don't replace these with forever if. They're way different! If <(LeavesClicked) = [HowManyLeavesThereAre]> Broadcast [LeavesFall v] End EndThen, for each leaf,
When I recieve [LeavesFall v] Glide [5] secs to x:[WhateverX is] y: [The ground's Y] //Fall down to the ground When I recieve [LeavesFall v] //Don't combine this with the one above Repeat until <(Y position) = (The ground's Y position)> Rotate [15] degrees ccw //Gives a nice fluttering motion for the leaves Wait [0.5] secs Rotate [15] degrees cw Wait [0.5] secs End
Offline
Maltese_Falcon wrote:
I'd make a variable called
(LeavesClicked).
Then for each of your leaves, I'd do:When [Leaf] clicked //When a leaf is clicked, If <(Costume #) = [Greenleaf] //If the current costume is the Green leaf, Switch to costume [BrownLeaf v] Change (LeavesClicked) by (1) EndThen, you only need to do this for one leaf:When gf clicked Forever //Always check for, (and don't replace these with forever if. They're way different! If <(LeavesClicked) = [HowManyLeavesThereAre]> Broadcast [LeavesFall v] End EndThen, for each leaf,When I recieve [LeavesFall v] Glide [5] secs to x:[WhateverX is] y: [The ground's Y] //Fall down to the groundWhen I recieve [LeavesFall v] //Don't combine this with the one above Repeat until <(Y position) = (The ground's Y position)> Rotate [15] degrees ccw //Gives a nice fluttering motion for the leaves Wait [0.5] secs Rotate [15] degrees cw Wait [0.5] secs End
I think I fixed it...
Offline
Maltese_Falcon wrote:
Maltese_Falcon wrote:
I'd make a variable called
(LeavesClicked).
Then for each of your leaves, I'd do:when [Leaf] clicked //When a leaf is clicked, if <(costume #) = [Greenleaf]> //If the current costume is the Green leaf, switch to costume [BrownLeaf v] change [LeavesClicked v] by (1) endThen, you only need to do this for one leaf:When gf clicked forever //Always check for, (and don't replace these with forever if. They're way different! If <(LeavesClicked) = [HowManyLeavesThereAre]> Broadcast [LeavesFall v] endThen, for each leaf,when I receive [LeavesFall v] glide [5] secs to x:[WhateverX is] y: [The ground's Y] //Fall down to the groundWhen I receive [LeavesFall v] //Don't combine this with the one above repeat until <(y position) = [the ground's y postion]> turn ccw [15] degrees //Gives a nice fluttering motion for the leaves wait [0.5] secs turn cw [15] degrees wait [0.5] secs endI think I fixed it...
I fixed it
With regards,
~7734f
Offline