JoC #20: Image manipulation – first contact

      What is important in life is life, and not the result of life.
            — Goethe

Today, we’re starting to look a little more at images. We’re starting with something quite easy: manipulating (programmatically) the world background. But this introduces important concepts which we will use shortly to do much more with images.

Also, this is another nice example of object interaction (as we know by now: one of the most important concepts in object -oriented programming). In this case, the world object interacts with an image object.

Download video

Concepts discussedimage manipulation


4 thoughts on “JoC #20: Image manipulation – first contact

  1. Pingback: JOC#20: Image Manipulation Take One - compu2Learn.co.uk

  2. I’m trying to make it so that each time I click on the world and create a ball, the ball is yet a different color. It’s the same idea as the ball’s color changing when it hits the wall, but I can’t figure out how to set the image so that it increments the same way. Does anyone point me in a direction?
    Thx!

    • public class Ball extends Actor
      {//create a randomballcolour integer for each of the ball colours
      private int randomballcolour = Greenfoot.getRandomNumber(4);
      /**
      * Create a Ball with constructor
      */
      public Ball(int direction)
      {
      //setRotation is a method in the Actor class, pass value to
      //direction integer
      setRotation(direction);
      //use randomballcolour integer to randomise image of each ball
      setImage(“button-” + randomballcolour + “.png”);
      imageNumber = 1;
      }

  3. This is probably too late, but for future reference, it’d be helpful if you post the code you did write.

Leave a Reply

Your email address will not be published. Required fields are marked *