Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
do you reset the health variable, when you recreate this object?
do you create a new instance, when the old die, or do you use the same?
health is a (local?) variable called hp.
Not sure how to reset the health variable when the object is recreated.
The enemy parent spawns the same enemy with the same instance id.
Can you respawn the same enemy (obj_enemy) with a different instance id?
obj_gui draw event (draws) the obj_enemy_parent health on the screen, top right.
obj_enemy_parent step event:
if obj_enemy (does not) exist (then) instance_create obj_enemy.
//standard stuff for respawning enemies.
Once the obj_enemy has created by the obj_enemy_parent, obj_gui no longer draws the health of obj_enemy_parent. If I try to draw the obj_enemy health, once it dies GM errors stating it does not detect the object.
_enemy = instance_nearest(x,y obj_enemy_parent);
if(_enemy != noone){
draw_text(x pos, y pos, _enemy.hp)
}
Not sure tho.
EDIT:
Why not do something like this instead:
// par gui step/draw event:
_enemy = (obj_enemy)
if(instance_exists(_enemy)){
with(_enemy){
draw_text(x pos, y pos, string(hp))
}
}