Answered step by step
Verified Expert Solution
Question
1 Approved Answer
the skeleton code is in the pictures. can you please do the requested compleating the homework part I dont know what specifically you need they
the skeleton code is in the pictures. can you please do the requested compleating the homework part
I dont know what specifically you need
they both have been included in the picture. world is the PigWorld the first pic. actor is the mushroom and pig.
Completing the Homework 1. Modify the constructor of Pigtorld so that the world is unbounded. 2. Modify the constructor of Pighorld to add a Pig object at (x, y) location (400, 300). 3. Modify the act method of Pioria to create a Mushroon object at a random x.coordinate at the top edge of the viewable area of the world. Make a new mushroom appear at the top on approximately 3% of all act calls. 4. Modify the act method of Mushroom to make mushrooms move down 1 unit toward the bottom of the screen on each act call 5. Modify the act method of Pig so that the pig follows the mouse. That is, the pig's location is set to be that of the mouse cursor. 6. Modify the constructor of Pigkorld to make sure that the pig image stays on top of all mushroom images as the pig moves. 7. Modify the act method of Po so that the pig'eats one mushroom that it intersects when the mouse is clicked. 8. Modify the act method of Mushroom so that the scenario stops running once a mushroom reaches the bottom of the viewable area of the world. 9. Modify the act method of Pia so that the scenario stops running once the pig has eaten at least fifteen mushrooms. Note: You will have to add a held to the Pig class. And although it's not necessary, you will probably want to add a constructor to the Pio class to initialize this field. import greenfoot.*; 7 (World, Actor, GreenfootImage, Greenfoot and Mouse Info /** * Write a description of class PigWorld here. * @author (your name) * @version (a version number or a date) */ public class Pigworld extends World * Constructor for objects of class PigWorld. public PigWorld) super (600, 400, 1); public void act() { import greenfoot.* 17 (World, Actor, GreenfootImage, Greenfoot and MouseInfo * Write a description of class Mushroom here. * @author (your name) * @version (a version numb */ public class Mushroom extends Actor public void act() * Write a description of class Pig here. * @author (your name) * @version (a version number or a date) public class Pig extend public void act() import greenfoot."; // (World, Actor, Greenfootlmage, Greenfoot and Mouselnfo) Write a description of class Pig World here. @author (your name) @version (a version number or a date) public class PigWorld extends World Constructor for objects of class Pig World. public Pig World super(600, 400, 1); public void act() { import greenfoot."; // (World, Actor, Greenfootlmage, Greenfoot and MouseInfo) Write a description of class Mushroom here. @author your name) @version (a version number or a date) public class Mushroom extends Actor public void act() import greenfoot."; // (World, Actor, GreenfootImage, Greenfoot and Mouselnfo) Write a description of class Pig here. * @author your name) * @version (a version number or a date) public class Pig extends Actor public void act) Completing the Homework 1. Modify the constructor of Pigtorld so that the world is unbounded. 2. Modify the constructor of Pighorld to add a Pig object at (x, y) location (400, 300). 3. Modify the act method of Pioria to create a Mushroon object at a random x.coordinate at the top edge of the viewable area of the world. Make a new mushroom appear at the top on approximately 3% of all act calls. 4. Modify the act method of Mushroom to make mushrooms move down 1 unit toward the bottom of the screen on each act call 5. Modify the act method of Pig so that the pig follows the mouse. That is, the pig's location is set to be that of the mouse cursor. 6. Modify the constructor of Pigkorld to make sure that the pig image stays on top of all mushroom images as the pig moves. 7. Modify the act method of Po so that the pig'eats one mushroom that it intersects when the mouse is clicked. 8. Modify the act method of Mushroom so that the scenario stops running once a mushroom reaches the bottom of the viewable area of the world. 9. Modify the act method of Pia so that the scenario stops running once the pig has eaten at least fifteen mushrooms. Note: You will have to add a held to the Pig class. And although it's not necessary, you will probably want to add a constructor to the Pio class to initialize this field. import greenfoot.*; 7 (World, Actor, GreenfootImage, Greenfoot and Mouse Info /** * Write a description of class PigWorld here. * @author (your name) * @version (a version number or a date) */ public class Pigworld extends World * Constructor for objects of class PigWorld. public PigWorld) super (600, 400, 1); public void act() { import greenfoot.* 17 (World, Actor, GreenfootImage, Greenfoot and MouseInfo * Write a description of class Mushroom here. * @author (your name) * @version (a version numb */ public class Mushroom extends Actor public void act() * Write a description of class Pig here. * @author (your name) * @version (a version number or a date) public class Pig extend public void act() import greenfoot."; // (World, Actor, Greenfootlmage, Greenfoot and Mouselnfo) Write a description of class Pig World here. @author (your name) @version (a version number or a date) public class PigWorld extends World Constructor for objects of class Pig World. public Pig World super(600, 400, 1); public void act() { import greenfoot."; // (World, Actor, Greenfootlmage, Greenfoot and MouseInfo) Write a description of class Mushroom here. @author your name) @version (a version number or a date) public class Mushroom extends Actor public void act() import greenfoot."; // (World, Actor, GreenfootImage, Greenfoot and Mouselnfo) Write a description of class Pig here. * @author your name) * @version (a version number or a date) public class Pig extends Actor public void act) Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started