This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-04-20 09:00:32

OwenAS
New Scratcher
Registered: 2013-04-20
Posts: 1

Leaf Falling Game

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

 

#2 2013-04-20 09:18:50

Maltese_Falcon
Scratcher
Registered: 2013-03-25
Posts: 100+

Re: Leaf Falling Game

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)
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
End
Then, 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

 

#3 2013-04-20 09:24:18

Maltese_Falcon
Scratcher
Registered: 2013-03-25
Posts: 100+

Re: Leaf Falling Game

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)
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
End
Then, 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

I think I fixed it...

Offline

 

#4 2013-04-20 10:53:23

7734f
Scratcher
Registered: 2010-12-23
Posts: 500+

Re: Leaf Falling Game

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)
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

Then, for each leaf,

when I receive [LeavesFall v]
glide [5] secs to x:[WhateverX is] y: [The ground's Y] //Fall down to the ground
When 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
end

I think I fixed it...

I fixed it  big_smile

With regards,
~7734f


http://internetometer.com/image/38992.png   http://i37.tinypic.com/2qixx6c.png

Offline

 

Board footer