Hi, I have gotten the current background color of my greenfoot game screen at 0,0 (what is "current" can be five possible colors) and want to be able to save it in my "colored square" actor so that I can then call on it in my Menu world which contains multiple levels. In all levels the new background will be called on. How do I code something in ColoredSquare which saves the information to be used in Menu World, level1 () {} for example? How would Menu world call on this information?
Here is my code in "ColoredSquare" Actor, public void act:
Main Problem aside: I have used getMouseInfo and Greenfoot.mouseClicked... is it unnecessary to use both? Is there a difference in using both or just Greenfoot.mouseClicked?
1 2 3 4 5 6 7 8 9 10 11 12 | if (Greenfoot.mouseClicked( this )) { MouseInfo mouse = Greenfoot.getMouseInfo(); if (mouse != null ) { getWorld().setBackground(worldImage); getWorld().getBackground().getColorAt( 0 , 0 ); //Get color of BG at (0,0) //getBackground, getColor at 0,0 // call saveColorBG(); } } |