Alice Community  

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

Reply
 
Thread Tools Display Modes
Random numbers & 3D Text
Old
Alex Rodriguez
Guest
 
Status:
Posts: n/a
Default Random numbers & 3D Text - 04-06-2009, 06:06 PM

I'm working on a class project where I make a simple game with a ring and a cone. The object is to have the ring move up and down and you move the cone in the ring to get points. I placed a 3D text of the number Zero for the score. I'm trying to make that 3D text increase by 1 every time the user scores a point (get the cone in the ring). I've created a basic outline toying around with some functions, but I'm not sure how to make it work. If I need to be more specific I'll be glad to post more.

Can anyone help please?
   
Reply With Quote
Old
Scott300
Senior Member
 
Status: Offline
Posts: 80
Join Date: Feb 2009
Location: Ohio
Default 04-06-2009, 10:21 PM

Make a variable named Number

number increment by 1

3dtext set text to world.number as a string
  Send a message via AIM to Scott300 Send a message via MSN to Scott300  
Reply With Quote
I can't get my number to increase by 1
Old
Alex Rodriguez
Guest
 
Status:
Posts: n/a
Default I can't get my number to increase by 1 - 04-07-2009, 03:48 PM

I can't get my world variable (score) to increase by 1 when the ring is within 1 meter of the cone which I have in an if/else statement.

If ring is within 1 meter of cone
increment world.score by 1

That should make the number increase by 1 when the ring is near enough to the cone, correct?


THe loop I have in the my point method is just so I can test that method so the number increase by 1. I need it to move up and down because in the game thats what the ring will be doing. If anyone can look at my world and let me know what I'm doing wrong, I would greatly appreciate it. Feel free to email me at arodriguez1212@msn.com

I can't test the method to make my 3D text change unless I can manage to work out the problem above. I'm frustrated at this point and want to throw the PC out the window.
Attached Files
File Type: a2w Lab3.a2w (247.0 KB, 22 views)
   
Reply With Quote
Old
draikon3
Guest
 
Status:
Posts: n/a
Default 04-08-2009, 07:46 AM

this looks about right
Attached Files
File Type: a2w Lab3.a2w (247.4 KB, 52 views)
   
Reply With Quote
Old
Alex Rodriguez
Guest
 
Status:
Posts: n/a
Default 04-08-2009, 08:29 AM

I changed approaches and made an event when something becomes true. I simply used the same statements (if [object] is within [X meters] of [object]
increment score by 1.

I must have been doing something wrong when trying to make a seperate method to call for the score to increment by one. After I made it into an event, it worked fine. Thanks for your help Scott, I was forgetting to add [what] as a string. And thanks draikon 3 for taking the time to look at my world.
   
Reply With Quote
Old
Scott300
Senior Member
 
Status: Offline
Posts: 80
Join Date: Feb 2009
Location: Ohio
Default 04-09-2009, 01:44 PM

Quote:
Originally Posted by Alex Rodriguez View Post
I changed approaches and made an event when something becomes true. I simply used the same statements (if [object] is within [X meters] of [object]
increment score by 1.

I must have been doing something wrong when trying to make a seperate method to call for the score to increment by one. After I made it into an event, it worked fine. Thanks for your help Scott, I was forgetting to add [what] as a string. And thanks draikon 3 for taking the time to look at my world.
You probably had it in a loop, thus nothing under the loop was being called until the loop finished, when its in a while things under it will run.
  Send a message via AIM to Scott300 Send a message via MSN to Scott300  
Reply With Quote
Torus project
Old
SRM7364
Guest
 
Status:
Posts: n/a
Wink Torus project - 04-10-2009, 02:13 PM

Could you send you post your final project here so that I can compare.

Thanks in advance.


Quote:
Originally Posted by Alex Rodriguez View Post
I changed approaches and made an event when something becomes true. I simply used the same statements (if [object] is within [X meters] of [object]
increment score by 1.

I must have been doing something wrong when trying to make a seperate method to call for the score to increment by one. After I made it into an event, it worked fine. Thanks for your help Scott, I was forgetting to add [what] as a string. And thanks draikon 3 for taking the time to look at my world.
   
Reply With Quote
Getting rid of decimals in 3DText
Old
ttkrakus
Guest
 
Status:
Posts: n/a
Default Getting rid of decimals in 3DText - 06-09-2009, 10:14 AM

I have a variable of type Number that I use to update the value of a 3DText object (like a score). All the values are integer, but Alice insists in adding ".0" to the 3DText. Is there a way to show just the integer part?

Thanks
   
Reply With Quote
Making a real an integer
Old
dejohnso
Guest
 
Status:
Posts: n/a
Default Making a real an integer - 06-25-2009, 12:12 AM

Quote:
Originally Posted by ttkrakus View Post
I have a variable of type Number that I use to update the value of a 3DText object (like a score). All the values are integer, but Alice insists in adding ".0" to the 3DText. Is there a way to show just the integer part?

Thanks
I do have a horrible solution for that. Make a random number with a minumum of your number with the .0 on it, and a max the same, and make it integerOnly. That will return the same number with the .0 removed.
   
Reply With Quote
Old
ttkrakus
Guest
 
Status:
Posts: n/a
Default 06-25-2009, 09:15 AM

Quote:
Originally Posted by dejohnso View Post
I do have a horrible solution for that. Make a random number with a minumum of your number with the .0 on it, and a max the same, and make it integerOnly. That will return the same number with the .0 removed.
Thanks dejohnso,

I am using Alice2.0 and it does not seem to have the IntegerOnly function.
Thanks again.
   
Reply With Quote
Reply

Thread Tools
Display Modes

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.