Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Random numbers & 3D Text (http://www.alice.org/community/showthread.php?t=2495)

 Alex Rodriguez 04-06-2009 07:06 PM

Random numbers & 3D Text

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.

 Scott300 04-06-2009 11:21 PM

Make a variable named Number

number increment by 1

3dtext set text to world.number as a string

 Alex Rodriguez 04-07-2009 04:48 PM

I can't get my number to increase by 1

1 Attachment(s)
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 [email]arodriguez1212@msn.com[/email]

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.

 draikon3 04-08-2009 08:46 AM

1 Attachment(s)

 Alex Rodriguez 04-08-2009 09: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.

 Scott300 04-09-2009 02:44 PM

[QUOTE=Alex Rodriguez;9627]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.[/QUOTE]

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.

 SRM7364 04-10-2009 03:13 PM

Torus project

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

[QUOTE=Alex Rodriguez;9627]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.[/QUOTE]

 ttkrakus 06-09-2009 11:14 AM

Getting rid of decimals in 3DText

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

 dejohnso 06-25-2009 01:12 AM

Making a real an integer

[QUOTE=ttkrakus;10541]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[/QUOTE]

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.

 ttkrakus 06-25-2009 10:15 AM

[QUOTE=dejohnso;10777]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.[/QUOTE]

Thanks dejohnso,

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

All times are GMT -5. The time now is 10:49 AM.