Hundreds of features to explore
Games made in Construct
Your questions answered
Trusted by schools and universities worldwide
Free education resources to use in the classroom
Students do not need accounts with us
What we believe
We are in this together
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
I cant fix my high score NaN error.
Before Playing a Round
After Playing A Round
NAN means Not A Number. Somewhere in your logic you are getting something assigned to your variable that is not counting as a number. Either that or you may need to round as certain things tend to create a lot of decimal (floating point) places in your numbers.
Develop games in your browser. Powerful, performant & highly capable.
None of my variables for the points, which is what is counted, use decimals, they are all whole numbers. Everyhting that would contribute to the score is in the Scoring group
Is there any chance that Base.Health may equal 0? If so then you are dividing by zero which would also cause the NaN error...
Also I notice that you are setting highscore both every second and on every tick. You should do one or the other. The every second would be better unless you need it sooner in which case you can do every 0.5 seconds.
I removed that right after I took this picture, it did not help. I set it to every 0.5 seconds.
It does equal zero at one point, but nothing is ever divided by it or another 0.
Sure it does, right there in your events it shows base.Health/100... if base.Health happens to be 0 at that point then you are dividing by 0...
It is [100*(base.Health/100)] which would be 100*(0/100) or 0
The other piece throwing me off is the finaldata.finaldata are you having an instance variable that has the same name as the object? Gah, just realized what time it is, time for me to hit the rack.