M
Minconan
Guest
The Error Report:
----------------------------------------------------------------------------------------------------------------------------------
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Draw Event
for object obj_hpbar:
Variable obj_hpbar.hp(100002, -2147483648) not set before reading it.
at gml_Object_obj_hpbar_Draw_0 (line 1) - if variable_instance_exists(obj_hp,hp) {
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_hpbar_Draw_0 (line 1)
----------------------------------------------------------------------------------------------------------------------------------
The Code of obj_hpbar :
[Draw]:
if variable_instance_exists(obj_hp,hp) {
barhp = obj_hp.hp
}
if variable_instance_exists(obj_hp,max_hp){
batmaxhp = obj_hp.maxhp
}
bar = (barhp / barmaxhp) * 100;
draw_healthbar(96, 32, 432, 64, bar, c_black, c_red, c_lime, 0, true, true)
----------------------------------------------------------------------------------------------------------------------------------
I also tried:
----------------------------------------------------------------------------------------------------------------------------------
The Code of obj_hp:
[Create]:
hp = 80
maxhp = 80
----------------------------------------------------------------------------------------------------------------------------------
I want make a heath bar for player object and I use [obj_hp] to hold the hp variable,and then, I want
[obj_hpbar] to use the (hp) and (max_hp) to drawing hp bar,but seems like there is a problem in [obj_hpbar].
[obj_hpbar] can't get the variables from [obj_hp]
----------------------------------------------------------------------------------------------------------------------------------
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Draw Event
for object obj_hpbar:
Variable obj_hpbar.hp(100002, -2147483648) not set before reading it.
at gml_Object_obj_hpbar_Draw_0 (line 1) - if variable_instance_exists(obj_hp,hp) {
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_hpbar_Draw_0 (line 1)
----------------------------------------------------------------------------------------------------------------------------------
The Code of obj_hpbar :
[Draw]:
if variable_instance_exists(obj_hp,hp) {
barhp = obj_hp.hp
}
if variable_instance_exists(obj_hp,max_hp){
batmaxhp = obj_hp.maxhp
}
bar = (barhp / barmaxhp) * 100;
draw_healthbar(96, 32, 432, 64, bar, c_black, c_red, c_lime, 0, true, true)
----------------------------------------------------------------------------------------------------------------------------------
I also tried:
barhp = obj_hp.hp
batmaxhp = obj_hp.max_hp
bar = (barhp / barmaxhp) * 100;
draw_healthbar(96, 32, 432, 64, bar, c_black, c_red, c_lime, 0, true, true)
batmaxhp = obj_hp.max_hp
bar = (barhp / barmaxhp) * 100;
draw_healthbar(96, 32, 432, 64, bar, c_black, c_red, c_lime, 0, true, true)
----------------------------------------------------------------------------------------------------------------------------------
The Code of obj_hp:
[Create]:
hp = 80
maxhp = 80
----------------------------------------------------------------------------------------------------------------------------------
I want make a heath bar for player object and I use [obj_hp] to hold the hp variable,and then, I want
[obj_hpbar] to use the (hp) and (max_hp) to drawing hp bar,but seems like there is a problem in [obj_hpbar].
[obj_hpbar] can't get the variables from [obj_hp]
Last edited by a moderator: