Hi, i am new to greenfoot and wanted to make a game. I have been stuck on this one thing is that i want to change a picture of my rocket after touching Pluto class, so that it looks like it lands on it. There is no problem with compiler etc. but it just does not work. Should i also put something to pluto class to work? Here is the code of this method:
and Pluto:
public void moveAround()
{
if(isTouching(Pluto.class))
{
setImage("MoonLander.png");
}
}import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Solar here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Pluto extends Actor
{
private GreenfootImage image = new GreenfootImage("Moon.png");
private int scalePercent = 100;
public Pluto(int scalePercent)
{
// scale Solar image
this.scalePercent = scalePercent;
int wide = image.getWidth()*scalePercent/90;
int high = image.getHeight()*scalePercent/90;
image.scale(wide, high);
// set initial image to a scaled one
setImage(image);
}
public void act()
{
// Add your action code here.
}
}
