Question: Im on chapter 10 problem 45E in introduction to programming with greenfoot 2nd edition. Iin myWorld class, it says it cant find method. my code

Im on chapter 10 problem 45E in introduction to programming with greenfoot 2nd edition. Iin myWorld class, it says it cant find method. my code thus far.

import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/** * Write a description of class Start here. * * @author (your name) * @version (a version number or a date) */ public class Start extends Actor { public GreenfootSound sound = new GreenfootSound("SleepAWAY.mp3"); private boolean off = true; /** * Act - do whatever the Start wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { if(Greenfoot.mouseClicked(this) && off) { sound.playLoop(); off = false; } else if(Greenfoot.mouseClicked(this) && !off) { sound.pause(); off = true; } }

import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/** * Write a description of class MyWorld here. * * @author (your name) * @version (a version number or a date) */ public class MyWorld extends World {

/** * Constructor for objects of class MyWorld. * */ public MyWorld() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super(600, 400, 1); addObject(newStart(),400, 250); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!