Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Counter Question (http://www.alice.org/community/showthread.php?t=6753)

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:

[CODE]
if(world.counter<=some number)
{
increment world.counter by one(world.counter++)
}
else
{
//Whatever you want it to do.
}[/CODE]

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 05:06 AM.

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