Indonesia Unity3D Game Developing
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Game Mewarnai Tutorial
Script Destroy GameObject With Health EmptyThu Mar 23, 2017 10:21 am by kamil

» [ASK HELP] Slide informasi di augmented reality
Script Destroy GameObject With Health EmptyTue Jan 03, 2017 8:58 pm by Briyan_ap

» ASK cara klik dan memunculkan informasi
Script Destroy GameObject With Health EmptyTue Jan 03, 2017 8:54 pm by Briyan_ap

» [Ask] mengubah game PC menjadi game Android
Script Destroy GameObject With Health EmptyTue Jan 03, 2017 10:57 am by NiethaChan

» Virtualisasi suatu Gedung mengunakan unity3D + google seketchUP
Script Destroy GameObject With Health EmptySat Dec 31, 2016 1:06 am by zeepank

» Minta Tolong, slideshow ngga muncul saat object di klik
Script Destroy GameObject With Health EmptyTue Dec 27, 2016 12:53 pm by Briyan_ap

» tolong dong lagi bikin button rotate tp button ga keluar
Script Destroy GameObject With Health EmptyWed Dec 21, 2016 1:15 pm by Lita Misae

» algoritma Minimax/negascout buat checkers
Script Destroy GameObject With Health EmptyWed Nov 30, 2016 1:51 am by ardiansa

» screenshot
Script Destroy GameObject With Health EmptyWed Nov 16, 2016 10:15 pm by azhari

Statistic

Script Destroy GameObject With Health

4 posters

Go down

Script Destroy GameObject With Health Empty Script Destroy GameObject With Health

Post  KzRaItoN Mon Sep 24, 2012 12:52 pm

Sedikit Script Destroy Object Bagi Yang Mau Buat Game (Beserta Health)
Thanks To : Ilham Hasymi Effendi & BurgZergArcade

Nih Scriptnya(Unity 3d) (C# Script) :
using UnityEngine;
using System.Collections;

public class EnemyHealth : MonoBehaviour {
public int maxHealth = 100;
public int curHealth = 100;
public int health;

public float healthBarLength;

// Use this for initialization
void Start () {
healthBarLength = Screen.width / 2;
}

// Update is called once per frame
void Update () {
AddjustCurrentHealth(0);
}

void OnGUI() {
GUI.Box(new Rect(10, 40, healthBarLength, 20), curHealth + "/" + maxHealth);
}

public void AddjustCurrentHealth(int adj) {
curHealth += adj;

if(curHealth < 0)
curHealth = 0;

if(curHealth > maxHealth)
curHealth = maxHealth;

if(maxHealth < 1)
maxHealth = 1;

healthBarLength = (Screen.width / 2) * (curHealth / (float)maxHealth);

if(curHealth <= 0){
Destroy(gameObject);
}
}
}

Semoga Membantu Ya Scriptnya, Hehehehehe Very Happy
KzRaItoN
KzRaItoN
Unity3D Newbie
Unity3D Newbie

Posts : 19
Points : 31
Reputation : 0
Join date : 2012-09-05

Back to top Go down

Script Destroy GameObject With Health Empty Re: Script Destroy GameObject With Health

Post  trutions Thu Sep 27, 2012 11:27 am

wah...setelah sekian lama ane nongkron di sini.,... akhirnya ada mastah yang posting.... Very Happy
trutions
trutions
Unity3D Newbie
Unity3D Newbie

Posts : 6
Points : 11
Reputation : 3
Join date : 2012-09-21

Back to top Go down

Script Destroy GameObject With Health Empty Re: Script Destroy GameObject With Health

Post  KzRaItoN Thu Sep 27, 2012 1:42 pm

trutions wrote:wah...setelah sekian lama ane nongkron di sini.,... akhirnya ada mastah yang posting.... Very Happy
hehehehehe, Iya Nih, Thanks ya dah mampir Very Happy
KzRaItoN
KzRaItoN
Unity3D Newbie
Unity3D Newbie

Posts : 19
Points : 31
Reputation : 0
Join date : 2012-09-05

Back to top Go down

Script Destroy GameObject With Health Empty Re: Script Destroy GameObject With Health

Post  aanimation Fri Mar 21, 2014 2:46 pm

setidaknya setiap baris yg diketik juga dipahami, hayo semangat  bounce 
aanimation
aanimation
Unity3D Newbie
Unity3D Newbie

Posts : 47
Points : 50
Reputation : 3
Join date : 2014-03-21
Age : 38
Location : Jogjakarta

https://dl.dropboxusercontent.com/u/25548837/majaGame/version5.h

Back to top Go down

Script Destroy GameObject With Health Empty Re: Script Destroy GameObject With Health

Post  kikysikancil Fri Jun 06, 2014 2:23 pm

Biar kata postingan udah lewat 2 tahun juga mesti tetap di apresiasi. Good job, master!
kikysikancil
kikysikancil
Unity3D Developer
Unity3D Developer

Posts : 178
Points : 197
Reputation : 15
Join date : 2014-06-06
Age : 41
Location : Bandung

http://id.tutorialnetworks.com

Back to top Go down

Script Destroy GameObject With Health Empty Re: Script Destroy GameObject With Health

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum