Jump to content

lifes and health


dennis
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Stop toying and make games

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...