Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Trying to create a counter for assignment!
Old
kenny216
Guest
 
Status:
Posts: n/a
Default Trying to create a counter for assignment! - 06-25-2010, 01:29 PM

Disappearing Act: Create a world with an array containing several different types of bugs (Animals / Bugs), other animals, people, or other objects of your choice. Include at least five objects in total. The objects should all move in different random directions. Hint: see the Random motion section in Ch. 6 of Learning to Program with Alice. Setup multiple events (when clicked) for each object that triggers a common method to make the object disappear. Use the IsShowing property to make the objects disappear. Your program should terminate when all bugs are disappear (i.e. have a counter that gets decremented each time a bug disappears).

I already have an array, the different objects moving in random directions, and I even know how to make them disappear when a mouse is clicked on the object. What I don't understand how to do is make a counter that gets decremented each time a bug disappears. Can someone point me in the right direction for creating a counter? Here's my world so that y'all do not think I am cheating or trying to take credit for someone's else work.
Attached Files
File Type: a2w DisappearingAct.a2w (1.76 MB, 47 views)
   
Reply With Quote
Old
kenny216
Guest
 
Status:
Posts: n/a
Default 06-27-2010, 03:28 PM

Is there anyone who can point me in the right direction of how to implement a counter? A clue or anything like that?
   
Reply With Quote
Old
Niteshifter
Guest
 
Status:
Posts: n/a
Default 06-27-2010, 07:37 PM

You can create a world-level variable and use the 'decrement X by 1' instruction where you need it.
   
Reply With Quote
Old
kenny216
Guest
 
Status:
Posts: n/a
Default 06-27-2010, 10:24 PM

Quote:
Originally Posted by Niteshifter View Post
You can create a world-level variable and use the 'decrement X by 1' instruction where you need it.
When I create the world level variable will I have to use it in the events window? So that it will correspond to when I click one each object.
   
Reply With Quote
Old
Niteshifter
Guest
 
Status:
Posts: n/a
Default 06-28-2010, 05:15 PM

You could, but you could also put it inside the method that is connected to the event that is fired.
   
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.