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

2018/11/6

Urgent Question

cesarinstalled cesarinstalled

2018/11/6

#
Hello, I was wondering if it is possible to have an gif image change when coming in contact with another subclass, for example I have a gif that is idle it moves a little but i want it to change to another gif when coming in contact with another gif. Thanks for the help and I also would like help I cannot get my subclasses to spawn randomly in the world Thanks for the help, Cesar
danpost danpost

2018/11/6

#
cesarinstalled wrote...
I was wondering if it is possible to have an gif image change when coming in contact with another subclass, for example I have a gif that is idle it moves a little but i want it to change to another gif when coming in contact with another gif.
Yes -- it is possible. Your terminology is suspect, however. I take what you said to mean:
I have an actor in the world whose image is to change when it intersects the image of an actor of a different type.
Basically:
if (isTouching(ClassB.class)) setImage(imageUponTouchingClassB);
It is best to have the image it is to take on after touching already created and held in a field as reading files from the directory and creating images both take substantial CPU time (as far as computing speed is concerned).
I cannot get my subclasses to spawn randomly in the world
Please show what you have tried.
You need to login to post a reply.