This method should not perform any action if the lightsaber is already off. This method will set the saberOn variable correctly upon completion.Ī public void returning method named saberOff() that will turn off JediNinjaViking’s lightsaber. If the light saber is not on, a sound should be played and then the setImage method should be used in succession to animate the light saber turning on. This method should not perform any action if the lightsaber is already on. Set the variables appropriately.Ī public void returning method named saberOn() that will turn on JediNinjaViking’s lightsaber. The JediNinjaViking will be tired but not bored after this operation. ![]() The methods setLocation, wait and setRotation will be useful for this method. The JediNinjaViking will be tired after this operation, so set the tired variable appropriately.Ī public void returning method named flipLeft() that will call flip(int) and pass a negative value for the distance the JediNinjaViking will flip to the left.Ī public void returning method named flipRight() that will call flip(int) and pass a positive value for the distance the JediNinjaViking will flip to the right.Ī private void returning method named flip(int) that will flip the JediNinjaViking 360 degrees to the left or right depending on the value that is passed in from flipRight and flipLeft. You should do something similar to find a random value for y. The statement Greenfoot.getRandomNumber(getWorld().getWidth()) will return an int value that is within the range of valid x values for the world of the JediNinjaViking. Required Instance Methods for JediNinjaViking ClassĪ public void returning method named setRandomLocation() that will calculate two separate random values for x and y and set the JediNinjaViking to that location. Design and implement the following methods in the Greenfoot classes provided according to the specifications.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |