This site requires JavaScript, please enable it in your browser!
Greenfoot back
makconas
makconas wrote ...

2015/11/20

java.lang.NumberFormatException:

makconas makconas

2015/11/20

#
public class TestWorld extends GWorld {
static String save ;
public void testSave(){
save = "";
save =qwerty.getX()+qwerty.getY()
} // System.out.print (save) 
public void loadSave(){
int X = Integer.valueOf(save.substring(0));
int Y= Integer.valueOf(save.substring(1));
}}
public class qwerty extends actor{
}
Royalblue64 Royalblue64

2015/11/20

#
Well, when retrieving the values, the substrings should be save.substring(0, 1) for X and save.substring(1, 2) for Y.
winnerpig winnerpig

2015/11/22

#
It seems not a good manner to save X and Y , since you dont know the unit of the number of X or Y coordinate。maybe you could used two variables to save X and Y respectly
You need to login to post a reply.