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

2015/10/19

Setting custom image

RadiantCheddar RadiantCheddar

2015/10/19

#
When I use this
import greenfoot.*;
import java.lang.Math;
public class Ball extends Actor
{
    static int ballX=100;
    static int ballY=0;
    static boolean isTouching;
    public void act() 
    {   
        ballX=getX();
        ballY=getY();
        GreenfootImage left = new GreenfootImage(bee1.png);
        if(Greenfoot.isKeyDown("right")){
            moveX(2);
        }
        if(Greenfoot.isKeyDown("left")){
            moveX(-2);
        }
        if(Greenfoot.isKeyDown("down")){
            moveY(2);
        }
         if(Greenfoot.isKeyDown("up")){
            moveY(-2);
        }
    }
    public void moveX(int x){
        setLocation(getX()+x,getY());
    }
    public void moveY(int y){
        setLocation(getX(),getY()+y);
    }
}
I says connot find symbol - variable bee1
danpost danpost

2015/10/19

#
Literal string values must be placed between a set of double quotes:
GreenfootImage left = new GreenfootImage("bee1.png");
You need to login to post a reply.