Hi guys, I have an issue with my game that no one can seem to find the solution to. I have made several posts on the forum as to my game having lag. I have altered the game more times than I can count and have even had other people look at the game and make alterations but every time I still end up with the same issue.
Now I have no idea anymore whether it is down to the coding or that Android phones struggle to operate games exported through intel XDK and CocoonJS, either way I am completely stuck as to what to do and am turning to you for guidance.
This isn't the first game it has happened to. I'll briefly explain the issue....
The game consists of a player and several enemies. Whenever the enemies collide with the player they are destroyed. When the enemies are destroyed there seems to be a lag for a moment and no one has any idea as to why. We have tried and altered everything yet the problem continues.
I would be more than happy to send a copy of the game to you to have a look at through PM. Please post below if you feel you can help. THANK YOU VERY MUCH!!!
This might be it:
When global variable Score is bigger than global variable Highscore, you are setting the webstorage "highscore" to score, but you are not changing the global variable highscore and as such this condition is true every tick and calls to the webstorage are executed every tick..
Great. Thank you for pointing that out!
Develop games in your browser. Powerful, performant & highly capable.
I figured it out! It was due to the size of the Score Text (being very large).
I would advice anyone who is planning to on making an android game that involves changing text e.g. a score, don't use the Text object. Instead use the SpriteFont object which will should stop lagging if anyone is suffering from the same problem. I found out that text is not well handled on Android phones where as Sprites work much better.
I used the font generator to customize my own SpriteFont and choose a font that I wanted to use. Its really straightforward. Follow the link below. Good Luck!