Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript window.setInterval(function() Need help Reply To: window.setInterval(function() Need help

#191874
tarnos12
Participant

Hey thanks for the reply for a short code, but still I can’t make it work for me. I will try to find an other way for interval function maybe. If there is any other. You can check my first post for the game link and check main.js file its long really long but you might find a bug :> btw I tried to delete all “intervals” except for hpregen and it still didnt work. Also you could give me some tips on coding, right now my code is like 6000 lines long, which I could probably make using much less code. This bug is the same for all intervals I made. Not sure what do you mean by “stalling later” but if you set maxhp it is supposed to stop once it reach that maxhp Thanks for all help :)

“edit” Also that short code you put “else health += hpregen;” wont this cause my health go over maxhealth? if my max health is 30 and I have 29, first “if” wont work because its not equal to 30 or higher than it, so the second will give my health = 29+ hp regen but of course first function will reset it after 1 second, but that 1 second I will have more health that I should have.