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

2017/6/28

set actor image

Klumb Klumb

2017/6/28

#
Hello, I'd like to set an actor's image from a greenfootImage but the setImage() method requires a java.awt.Image() object. how can I transform a Greenfoot image into a java.awt.Image()? or how do I create a .png from the greenfoot image?
danpost danpost

2017/6/28

#
There are two setImage methods provided in the Actor class, neither of which requires a java.awt.Image object. One requires a java.lang.String object (the filename of an image in the 'images' folder of the project in your file directory) and the other, a greenfoot.GreenfootImage object. If you are getting a message that says you need a java.awt.Image object, then maybe you are not using setImage on an Actor object to begin with. Show the codes (with context) you are attempting to use.
Klumb Klumb

2017/7/3

#
Hello, I don't know what has changed now but it works. thanks anyway!
You need to login to post a reply.