CSC 171 Lecture 5: Tue Jan 31
Document Summary
Characters as they move (or idle animation, like when a character starts dgeting after not being commanded to move for a while) Objects as they change (like damaged or made healthy) Setimage( lename) is a method in the actor class. Usage #1: set an image for this actor from an image le. The le may be a jpeg, gif, or png format. the le should be located in the project directory. public void setimage(java. lang. string lename) Illegalargumentexception is the name of the error that is thrown when you do something wrong. to avoid a crash: catch (exception handler parameters) Usage #2: set the image of the actor to a greenfoot speci ed image public void setimage(greenfootimage image) How to code usage #2: myimage = new greenfootimage( name of the le ); setimage(myimage); Tuesday, january 31, 2017: you can specify the name of the le algorithmically, you can manipulate the image in memory before setting this.