Hello, can anyone help me in my farm game :(( I just want to make a menu that include buy button, sell button, and look our animals and plants button. the problem is, when I have finished making a menu board for 3 list (buy, sell and look). I used mouse clicked to choose one of them, for example I choosed buy button to buy plants. but when I clicked the button, the list of plants became collided with the previous 3 lists (buy, sell and look). and how can if i finished use the menu that I can back to my game (FarmWorld). can anyone help me? :(( I'm sorry my english is bad because I'm from Indonesia. Here's My code
1. Here's for first menu when I touching the garden
2. and here's the code for buying plants.
can anyone help me pls T^T. this is my homework and I can't do anythingg
And how can that I can back play my game when I used the menu because there's no back buttons (I didn't know how to use) :(
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | public class Board1 extends World { /** * Constructor for objects of class Board1. * */ public Board1() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super ( 595 , 535 , 1 ); showText( "====Garden===" , 295 , 90 ); showText( "Buy" , 250 , 190 ); showText( "Sell" , 250 , 310 ); showText( "Look" , 250 , 435 ); prepare(); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | public class List2 extends Button { /** * Act - do whatever the List2 wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { // Add your action code here. if (Greenfoot.mouseClicked( this )){ Greenfoot.setWorld( new Buy Plant()); /*this what's makes collided with menu before because I can't remove the Board1 :(( */ } } } |