Alice Community  

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

Reply
 
Thread Tools Display Modes
How do I make a simple counter?
Old
general
Guest
 
Status:
Posts: n/a
Default How do I make a simple counter? - 05-08-2006, 03:25 AM

I'm trying to make a counter of sort with the 3D text. I want it to count the number of times the ball bounced. It's an animation if that helps. So, like when the ball bounce the text will change to 1, another bounce and it will change to 2 etc etc. I only managed to put a line that changes the text to 1 or 2 after a bounce but what if I had 100 bounces? I can't do every single line. I know it has something to do with variable but I can't seem to figure it out. Any help would be appreciated,



Many thanks
   
Reply With Quote
they say a picture is worth a thousand words...
Old
Jabberwocky
Guest
 
Status:
Posts: n/a
Default they say a picture is worth a thousand words... - 05-09-2006, 07:43 PM

If you'll put a loop around your bounce routine, the loop has a built in index variable. Just set your 3D text to the value of the index variable. You'll need to convert the index variable, it's a number, to a string so you can display it as text in the 3D text object.

I've attached an example. When you save it locally just make sure the extension is ".a2w" not ".zip" and you should be able to open it in Alice.

Have fun!
Attached Files
File Type: a2w counter.a2w (47.1 KB, 906 views)
   
Reply With Quote
Zip Files
Old
Chrono
Guest
 
Status:
Posts: n/a
Default Zip Files - 11-28-2006, 09:47 PM

Zip files will play in alice but you have to change the type of file to "All"
   
Reply With Quote
Displaying Counter
Old
jyby
Guest
 
Status:
Posts: n/a
Default Displaying Counter - 01-30-2009, 02:03 PM

The value is displayed as a real value (e.g. 0.0), even when the counter is an integer.
Is there a way to display just an integer?

(Other than creating many copies of all the digit and managing them as objects to display the digits of the integer at the correct location, which would be a nice exercise in itself, but which would more than double the code length of any other project...)
   
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.