I have created two dice and I wish them to both roll when another actor is clicked. This is the code in the dice
And this is the code in the button
1 2 3 4 | public dice() { getImage().scale( 300 , 300 ); } |
1 2 3 4 5 6 7 8 9 | public void clicked() { if (Greenfoot.mouseClicked( this )) { value = Greenfoot.getRandomNumber( 6 )+ 1 ; dice d = new dice(); d.setImage(value + ".jpg" ); d.getImage().scale( 300 , 300 ); } |