whats boolean


1 | public boolean hasStarted = false ; |
1 2 3 4 5 6 7 8 9 10 | public void act() { if (!hasStarted && Greenfoot.mouseClicked( null )) { hasStarted = true ; // code for some action(s) } if (!hasStarted) return ; // other code within act() } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class house here. * * @author (your name) * @version (a version number or a date) */ public class house extends World { /** * Constructor for objects of class house. * */ public house() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super ( 400 , 600 , 1 ); soilier gunman = new soilier (); addObject(gunman, 200 , 550 ); zombie zombie = new zombie (); addObject(zombie, 200 , 60 ); public boolean hasStarted = false ; public void act() { if (!hasStarted && Greenfoot.mouseClicked( null )) { hasStarted = true ; // code for some action(s) } if (!hasStarted) return ; // other code within act() } } } |
1 | zombie Zombie = new zombie(); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class house here. * * @author (your name) * @version (a version number or a date) */ public class house extends World { /** * Constructor for objects of class house. * */ public house() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super ( 400 , 600 , 1 ); soilier gunman = new soilier (); addObject(gunman, 200 , 550 ); zombie Zombie = new zombie (); addObject(Zombie, 200 , 60 );}} public boolean hasStarted = false ; public void act() { if (!hasStarted && Greenfoot.mouseClicked( null )) { hasStarted = true ; viod removeObject(instuction) } if (!hasStarted) return ; // other code within act() } } } |