Alice Community

Alice Community (
-   How do I...? (
-   -   Counter Question (

John Smithy 06-13-2011 07:17 PM

Counter Question
How would I go about making a counter stop, so that if I was to create a simple game for a young child, if they clicked on say a cow more than once, the counter would go up, but stop after multiple clicks?

legolizard 06-13-2011 07:52 PM

Well you would use an if statement and say something like:

if(world.counter<=some number)
increment world.counter by one(world.counter++)
//Whatever you want it to do.

John Smithy 06-14-2011 09:32 PM

So, theroretically, I could have it go up to 1, if they clicked on the cow once, then if they tried to again, and say the new object is a chicken, it wouldn't go up?

legolizard 06-15-2011 09:56 AM

Yes, you could do this as well, however you would have to create two different "when the mouse is clicked on....." events both of which must call the same method.

All times are GMT -5. The time now is 07:13 AM.

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