As
@Catan said the code has a lot of problems.
I had game maker open so i copied the code and there are missing braces and some that don't even go the right way.
for instance
Code:
{
else if (obj_player.hp >= (i+.5)*8)
{
that first brace is backwards.
anyway I think I cleaned it up for anyone who wants to see
Code:
if (instance_exists(obj_player)) {
xt = 944;
yt = 215;
for (i = 0; i < obj_player.hp_containers; i += 1) {//<- this part I changed from i++
ht_index = 0;
if (i > 7) {
xt = 880;
yt = 206;
}
if (player.hp >= (i+1)*8) {
ht_index = 2;
} else if (obj_player.hp >= (i+.5)*8) {
ht_index = 1;
}
draw_sprite_ext(spr_hearts,ht_index,xt+I*8,yt,1,1,0,c_white,1)
}
}
Not sure if you're familiar with
spaghetti code or
dry code
you want dry code not spaghetti code but this looks vary tasty (I like spaghetti)
things like player.hp >= (i+.5)*8 are the reason Catan now needs pain pills for his headache
I'm curious where you got this code. I assume you didn't write it otherwise you wouldn't have to translate i++ to i+=1
At any rate you're complaining about the lack of 8.0 support but that's because there are very very few differances between the 2. Mostly just performance and visual updates with the editor, they barely changed any of the actually GML language.
I would look into the actual value of obj_player.hp_containers
When you collide with your container is that the variable being changed? if so then that's the source of your problem.
Otherwise look into if(player.hp >= (i+1)*8
Either the hp variable is wrong or (i+1)*8 is wrong