Alice Community  

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

Reply
 
Thread Tools Display Modes
Counter Question
Old
John Smithy
Junior Member
 
Status: Offline
Posts: 5
Join Date: Jun 2011
Default Counter Question - 06-13-2011, 07:17 PM

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?
   
Reply With Quote
Old
legolizard
Senior Member
 
legolizard's Avatar
 
Status: Offline
Posts: 242
Join Date: Jan 2011
Location: Aboard the Hyperion escaping the zerg.
Default 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.
}


"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."-Albert Einstein
   
Reply With Quote
Old
John Smithy
Junior Member
 
Status: Offline
Posts: 5
Join Date: Jun 2011
Default 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?
   
Reply With Quote
Old
legolizard
Senior Member
 
legolizard's Avatar
 
Status: Offline
Posts: 242
Join Date: Jan 2011
Location: Aboard the Hyperion escaping the zerg.
Default 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.


"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."-Albert Einstein
   
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.