dennis Posted October 6, 2011 Share Posted October 6, 2011 Hello all, How to add a health counter ? lifes counter ? and kill zones such as 30 seconds under water is decreasing life? Cheers! Quote Link to comment Share on other sites More sharing options...
Laurens Posted October 6, 2011 Share Posted October 6, 2011 Do you mean from a user interface perspective or from a programming perspective (as in the domain model)? Quote Link to comment Share on other sites More sharing options...
dennis Posted October 6, 2011 Author Share Posted October 6, 2011 Do you mean from a user interface perspective or from a programming perspective (as in the domain model)? The Programming aspect in combination with the graphical interface... but like: 100 health. when under water for 30 seconds life decreasing. and then on 0 you will respawn at start position. and when life decreases the health bar will decrease too. how is this possible? and any manuals for this? Cheers! Quote Link to comment Share on other sites More sharing options...
Laurens Posted October 6, 2011 Share Posted October 6, 2011 In its most basic form I would simply start running a counter the second the player's altitude is less than 0 (this may ofcourse not always mean the player is submerged, you probably need some more complicated algorithm to determine whether or not the player is under water). Whenever that counter hits 30, start decreasing the health of the player each update. Game Coding Complete (Third Edition) defines a useful Process/ProcessManager for these sort of long running processes (i.e. spanning more than one Update call). I can highly recommend the book. As far as the user interface is concerned you could simply make some health bar in Paint and do DrawImage (or whatever it is called) with varying width to represent the player's current health. Quote Link to comment Share on other sites More sharing options...
dennis Posted October 6, 2011 Author Share Posted October 6, 2011 Okay thanks, mybe for determining the user is within the water the players location, or something like that, because the game is island based. or do I need to set this in the water script? I just need the player to die XD whenever he is falling or when he is benead the surface or even when he gets hit by a bullet... Cheers! Quote Link to comment Share on other sites More sharing options...
Laurens Posted October 6, 2011 Share Posted October 6, 2011 Getting hit by a bullet could easily be solved with a raycast. Whenever someone hits the trigger button, do a raycast and see if it hits the player. If so, kill him off. http://www.leadwerks.com/wiki/index.php?title=Raycasting#LinePick Quote Link to comment Share on other sites More sharing options...
dennis Posted October 6, 2011 Author Share Posted October 6, 2011 Getting hit by a bullet could easily be solved with a raycast. Whenever someone hits the trigger button, do a raycast and see if it hits the player. If so, kill him off. http://www.leadwerks.com/wiki/index.php?title=Raycasting#LinePick I see it isn't possible in LUA, am I correct? and I'm a beginner so not really good with the whole lua concept. Quote Link to comment Share on other sites More sharing options...
Rick Posted October 6, 2011 Share Posted October 6, 2011 I think the documentation just wasn't updated but I'm pretty sure it's possible. Give it a try. Use the fps script that comes with the editor for an example as I believe it does line picking. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted October 6, 2011 Share Posted October 6, 2011 Or you could just put an invisible squarre mesh that covers the water mesh, and when your character Vertex of the mouth is on the volume of the squarre he is underwater. It could be a bone of the mouth instead of vertex also. And like it has been said, just take the altitude of the water could the water plane be at 0 or any other value , if the bone of the mouth is under, your character is underwater whatever the animation you would play : this is the accurate way The simple way : Detect if your character is swimming (what you should program when your character have the water reaching his torso), and you could manage a simple variable when the player would push the character to go underwater and when he goes off undewater : 1 = underwater 0 = not underwater There are lot of ways of programming that. You should study game programming in some basic books and begin simple games, after that you'll know that you will be able to manage anything you want Quote Stop toying and make games Link to comment Share on other sites More sharing options...
dennis Posted October 6, 2011 Author Share Posted October 6, 2011 I think the documentation just wasn't updated but I'm pretty sure it's possible. Give it a try. Use the fps script that comes with the editor for an example as I believe it does line picking. thanks for the help. @YouGroove thanks will read some more books. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.