Hi, I was wondering if it's possible to create GUI for my game. I am new to Greenfoot so I hope anyone can help me with this or redirect me to it,
Thank you in advance.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import greenfoot.*; public class TitleScreen extends World { Actor btnExit, btnStart; public TitleScreen() { super ( 800 , 600 ,, 1 ); btnExit = new Button( "Exit" ); addObject(btnExit, 400 , 500 ); btnStart = new Button( "Start" ); addObject(btnStarrt, 400 , 400 ); } public void act() { if (Greenfoot.mouseClicked(btnStart)) Greenfoot.setWorld( new GameWorld()); if (Greenfoot.mouseClicked(btnExit)) Greenfoot.stop(); } } |
1 2 3 4 5 | MouseInfo mouse=Greenfoot.getMouseInfo () ; if (Greenfoot . mousePressed ( null ) ) int x = mouse.getX(); int y = mouse.getY(); if (x> 100 && x< 150 && y> 100 && y< 150 ) showText( "exit" , 300 , 300 ); |