View Single Post
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 06-11-2010, 10:16 PM

Yes, you create a world number variable in the world.properties tab and call it "score". Then, in the method that detects when the bullet is within the distance of the target, just add right after that code: (score = score + 5). This will make the variable "score" go up by 5 (for example if the score is 15, it will be (score = 15 + 5) and the new score will be 20).

Then you probably want to display it, so add a 3d Text object at the end of the object library and set it in the place near the camera that you want it, and go to its property tab and change its vehicle to "camera" instead of "world". This will make the text follow the camera where it goes instead of staying still while you move around. Now for the text to display the new score in the number variable, go back to the method that you incremented score by 5 and right after that block of code. For this one, go to the 3d Text object properties tab and drag where where it says "text" underneath the increment block of code I said before. This will let you change the text of the 3d Text. Just set it to default string at first, but you will change it now. Now go to the world.functions tab and look for "(what) as a string" and drag that into the place where it says "default string". It should ask you to put in something for the parameter "(what)". For this, look for where it says world.score and click on that. Now just click on the arrow on the right of the block of code and click on Duration, click on Set Value, and type in 0 and press enter (this will make it happen instantly instead of over the course of 1 second) and now you are done. Now you can test it.

Wow that was a lot to write, it took be about 15 minutes.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote