Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
the snake game don't like me.
#2
I'm assuming that means you're having problems with this line:
[code2=java]if (score > Integer.parseInt((highScore.split(":")[1])))[/code2]

If this is so, then the problem is that the highScore variable does not actually contain a colon! So the data past the colon could not be retrieved. This can be fixed by adding a check like
[code2=java]if (highScore.contains(":"))[/code2]

So, you could combine them to prevent errors, like so:
[code2=java]if (highScore.contains(":"))
{
if (score > Integer.parseInt((highScore.split(":")[1])))
{
//do stuff here
}
}[/code2]

I hope that this helped!
My Blog | My Setup | My Videos | Have a wonderful day.


Messages In This Thread
Re: the snake game don't like me. - by brandonio21_phpbb3_import2 - 08-22-2013, 09:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Drunk_Snake Game PLEASE HELP!! andre2pi 2 11,575 01-05-2014, 11:15 PM
Last Post: brandonio21
  How to export Snake Game as a Runnable JAR file? bedigursimran 0 7,197 11-19-2013, 10:01 PM
Last Post: bedigursimran
  NumberFormatException with Snake Timkat1994 1 8,943 09-17-2013, 11:11 PM
Last Post: brandonio21

Forum Jump:


Users browsing this thread: 1 Guest(s)