Hey i’m currently trying to make a 2D platformer, and i’ve reached the stage where i want to make the enemies work out, so what i’m currently strangling with is to make a script that subtracts my 1 of my ¨hearths¨ ( I have made a GUI-texture and placed out some hearths, and i’ve also made a enemy that shoots towards my character)
Here’s my healthcontroll script so far :
var health1 : Texture2D; //one life left
var health2 : Texture2D; //two life left
var health3 : Texture2D; //full heatlh
static var LIVES = 3;
function Update (){
switch(LIVES)
{
case 3:
guiTexture.texture = health3;
break;
case 2:
guiTexture.texture = health2;
break;
case 1:
guiTexture.texture = health1;
break;
case 0:
//game over script here
break;
}
}
So i know i’ll have to make script that will subtract my ¨LIVES¨, does anyone have a example of such a script? would love to get this scripting done