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

2014/5/13

Tile Changing Color

1
2
3
4
anonymousse anonymousse

2014/5/20

#
Would I add that to above color or the main area? I keep getting illegal start of expression:
public void changecolor2()    
{    
    Tile tile = (Tile)getOneObjectAtOffset(0, 0, Tile.class);  
    int arrowColor = (Arrow)getWorld().getObjects(Arrow.class).get(0);).getColor();  
    color = arrow.getColor
    setImage("egg"+color+".png");    
}    
It also told me to add the ; after get(0) and I'm just making sure if it would work. Also, what is the get(0) for?
danpost danpost

2014/5/20

#
I just missed an open parenthesis in line 4.
public void changecolor2()    
{    
    Tile tile = (Tile)getOneObjectAtOffset(0, 0, Tile.class);  
    color = ((Arrow)getWorld().getObjects(Arrow.class).get(0)).getColor();  
    setImage("egg"+color+".png");    
}
I am lost as to why line 3 in there.
You need to login to post a reply.
1
2
3
4