我会如何写“如果sticker1放置在数组中”然后...我的目标是将贴纸放置并输入到数组中作为名称,并将坐标保存到save.txt文件中。从那里,我可以点击一个加载按钮,它会加载贴纸并将其放置在确切的坐标处。如何将图像的名称及其坐标写入save.txt文件?
if (hatSoundPlay){ //if hatSoundPlay is true
hatsound.play(); //and a hatsound will play
sticker sticker1 = new sticker();//creates a new sticker1
sticker1.arraysticker(hatPicture, "hat.png", clickX, clickY);//places sticker
image ++;//increments image by 1
arraysticker[image] = sticker1;//puts sticker 1 into the array
然后为保存代码。
else if (savePicture.isPointInElement(clickX, clickY)){
FileWriter fw = new FileWriter("save.txt");
for (int i = 0; i < arraysticker.length; i++);
if (sticker1.images[images].isShowing){
//I want the iff statement ^^ to say if sticker if placed in the array
//fw.write name and coords into save.txt
}
}