PDA

View Full Version : Setting Lives


deadlyrun123
12-27-2013, 02:19 PM
Hey guys, I am new to the Alice community, and would like some assistance in my project. I am making a fighter project, similar to dragon ball z; I know how to make event listeners, while loops, and if statements as well as collisions. I am really stuck on setting lives for my character and the villain it is going to fight. I would like to know how to make the lives of a character go down each time a character is punched.

fourbros
12-27-2013, 05:11 PM
The dbz game sounds interesting. If you want to make an hp bar, use variables. For an example; set the variable(called HP) to 10. Each time a character is hit, HP gets decremented by 1. Once HP has been knocked down all the way to zero, the other character wins.

Hope this helps.



PS: I'm pretty sure that arty\sfunk\jediaction\etc. could come up with better advice. :}

mnuffer
11-07-2014, 01:05 PM
I, too, am struggling with how to either count lives, track time or show a score. I can create a variable called score as I did in Alice 2 and then decrement it as appropriate. My problem comes in that I can't see the variable change value and I can't convert the number variable to a string so that it can be used as text for the 3D text object that would show the score or time, etc. Please help!

MrMoke
11-07-2014, 06:20 PM
It's not as clean as in Alice2, but it can be done after a little research.

Attached is a short countdown program as an example. Forum doesn't allow .a3p files to be uploaded, so I had to zip it.

Good Luck

ajsnarr98
11-09-2014, 09:19 AM
I am currently making a game in alice 3 that has a health bar. The way it works is there are 10 billboards that I created with a custom image. To do that click on the project tab, then resource manager and then import image. If you create the billboard with the image on it it will be automatically resized to the image. Each of my billboards is a version of the health bar with a different amount of health. The way the bar works is I have a shape called healthBarMarker which is a vehicle to the camera and a variable called health. The health bar being currently used is also a vehicle of the camera. When the health variable decreases, the current health bar is given an opacity of 0 and the new health bar an opacity of 9. Then the first health bar ceases to be a vehicle of the camera and the new one does. The new one is then moved and oriented to the shape called healthBarMarker. Each of these actions has a duration of .01 seconds.

MrMoke
11-10-2014, 08:15 AM
This method could be implemented in several different ways, and save space by cutting down the number of bars to one...

mnuffer
11-10-2014, 10:33 AM
Thanks for the code sample. It is what I was looking for. Thanks!

MrMoke
11-11-2014, 08:43 AM
Glad I could help.

hmerrillb
11-23-2014, 09:21 AM
helpful topic..it helped me lot...thanks guyes..:)