Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Question about FPS (http://www.alice.org/community/showthread.php?t=4578)

Quantumpower 06-11-2010 06:48 PM

Question about FPS
 
I'm in grade 9 and very interested on Alice because I chose a course for next year(gr. 10) and we will be using alice.
How to make a revolver shoot and then when the bullet reaches a certain object it gets killed. How can I put a score system on the project I'm planning to make for example when the player kills a target +5 points and it adds up.

DensetsuNoKaboom 06-11-2010 06:50 PM

One word: variables. Set it so that "when bullet is within 1 meter of enemy, then variable.score increment by 1".
Or at least I think that's how it goes.

Dameria 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. :D

jediaction 06-12-2010 08:03 AM

[QUOTE=Quantumpower;22221]I'm in grade 9 and very interested on Alice because I chose a course for next year(gr. 10) and we will be using alice.
How to make a revolver shoot and then when the bullet reaches a certain object it gets killed. How can I put a score system on the project I'm planning to make for example when the player kills a target +5 points and it adds up.[/QUOTE]

Well, you could do an increamenting count or a count that i like doing which is a True and False type. But if your new, I would be happy to help you with whatever you needed. So please ask. The counting, I made an example already, You could use it and switch the points to every 5. Increamenting is a little different. You can just follow Damerias steps. I'll be here to help


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

Copyright ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.