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

2017/1/7

Adding "1" to end of filename

arianne_navarra arianne_navarra

2017/1/7

#
Hi! There's an error that says FileNotFoundException: Could not find file. I noticed that it adds "1" to the end of the filename that it's finding. I kept on rechecking the name of the file and made sure it matched the one in the code but there's still an error.
danpost danpost

2017/1/7

#
arianne_navarra wrote...
Hi! There's an error that says FileNotFoundException: Could not find file. I noticed that it adds "1" to the end of the filename that it's finding. I kept on rechecking the name of the file and made sure it matched the one in the code but there's still an error.
Please show the actual filename (from the properties frame for the image file; including the actual extension -- case is important) and the code you are using to access it.
arianne_navarra arianne_navarra

2017/1/7

#
this one?
danpost danpost

2017/1/7

#
There are no suffixes in the filenames you have given. Those are probably webpage names. Right click on the image(s) and get the properties to acquire the actual path and filename.
danpost danpost

2017/1/7

#
The filename of the first one is 'https://s30.postimg.org/z66lgpg1t/Screenshot_12.png' and the file image is:
arianne_navarra arianne_navarra

2017/1/7

#
arianne_navarra arianne_navarra

2017/1/7

#
danpost danpost

2017/1/7

#
Rename your 'battleship.png' file to 'battleship0.png' (with a zero) and adjust the image set in the constructor to match.
arianne_navarra arianne_navarra

2017/1/7

#
danpost danpost

2017/1/7

#
Remove the '0' from the filename in the 'animateFlame' method of the battleship class. Your images do not appear to be in the 'images' folder of the scenarios/battleship folder. Right click on a class icon and select 'Set image...'. You should see your images displayed on the lower left of the panel. If they are not, then you need to import them (use the Browse button).
arianne_navarra arianne_navarra

2017/1/7

#
.
arianne_navarra arianne_navarra

2017/1/7

#
is this right?
arianne_navarra arianne_navarra

2017/1/7

#
It still adds 1 at the end
danpost danpost

2017/1/7

#
Your code suggests that you have 4 images: 'battleship0.png', 'battleship1.png', 'battleship2.png' and 'battleship3.png'. Since you only have one, namely 'battleship0.png' (currently), then I do not see what the purpose of the 'animateFlame' method or the 'frame' field are for.
You need to login to post a reply.