Jump to content
dennis

lifes and health

Recommended Posts

Hello all,

 

How to add a health counter ?

lifes counter ?

and kill zones such as 30 seconds under water is decreasing life?

 

Cheers!

Share this post


Link to post

Do you mean from a user interface perspective or from a programming perspective (as in the domain model)?

Share this post


Link to post

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!

Share this post


Link to post

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.

Share this post


Link to post

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!

Share this post


Link to post

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.

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...