Is there any way to add something like radiation add make that take off your player healt ???
Or to make some Vacuum space and then your player needs to cary mask some tipe of mask with oxkigen ???
Is there any way to add something like radiation add make that take off your player healt ???
Or to make some Vacuum space and then your player needs to cary mask some tipe of mask with oxkigen ???
Yep.
Would you explain me pls ?
It depends on your project - you’ll need to write scripts to handle health, and scripts to apply damage. This is really more of a general game structure/design question than a scripting question - your best bet would be to go through one of the excellent tutorials found here: http://unity3d.com/support/resources/tutorials/
The quickest way to prototype and test would be to say that while the player is within the constraints of a specific trigger - run script. When he leaves - script stops.
Then you can expand on whatever method you’d like to trigger health degeneration or whatever else you’d like.
well that is most my problem how to make that “SPACE”. I have an idea of health script but don’t know how to make that " SPACE " thing
There are multiple ways. You can have a script checking the position of the player every now and then, you could use colliders, triggers…
If you still don’t understand what most of us are saying here, you should try doing some general unity tutorials.
You could use a trigger to make that “SPACE”. Then just use OnTriggerEnter and OnTriggerExit.
In any case though, it looks like you need to read some tutorials and learning docs. Check the signature.
Yes triggers would be your best bet.
Yep.
Health script:
//Health.js
var health = 100; //starting health
function TakeDamage(){
health -= 1;
}
And then radiation:
//Radiation.js
function OnTriggerStay(col : Collider){
col.gameObject.SendMessage("TakeDamage");
}
Regards,
-Lincoln Green
How fast is OnTriggerStay executed anyway?
To my knowledge, it’s called every every frame between OnTriggerStay and OnTriggerExit. My script above would decrease health at an insane rate, so you’d probably want to add an invulnerability period, a la:
//Health.js
var health = 100; //starting health
var invulnerableTime = 1; //invulnerable for 1 second after damage
private var _invulnerableTimer = 0.0;
function TakeDamage(){
if(_invulnerableTimer > 0.0) return;
health -= 1;
_invulnerableTimer = invulnerableTime;
}
function Update(){
_invulnerableTimer -= Time.deltaTime;
}
+1