Introduction to Programming with Greenfoot: Object–Oriented Programming in Java™ with Games and Simulations, First Edition

Book description

Introduction to Programming with Greenfoot: Object-Oriented Programming in Java with games and Simulations is ideal for introductory courses in Java Programming or Introduction to Computer Science.

The only textbook to teach Java programming using Greenfoot–this is “Serious Fun.”

Programming doesn’t have to be dry and boring. This book teaches Java programming in an interactive and engaging way that is technically relevant, pedagogically sound, and highly motivational for students. Using the Greenfoot environment, and an extensive collection of compelling example projects, students are given a unique, graphical framework in which to learn programming.

Table of contents

  1. Introduction to Programming with Greenfoot
    1. Overview of Greenfoot
    2. Introduction to Programming with Greenfoot
    3. List of scenarios discussed in this book
    4. Preface
      1. Accessing Supplementary Materials
      2. Supplementary Materials Available for Students
      3. Supplementary Materials Available for Instructors
    5. Acknowledgments
    6. Introduction
    7. 1. Getting to know Greenfoot
        1. 1.1. Getting started
        2. 1.2. Objects and classes
        3. 1.3. Interacting with objects
        4. 1.4. Return types
        5. 1.5. Parameters
        6. 1.6. Greenfoot execution
        7. 1.7. A second example
        8. 1.8. Understanding the class diagram
        9. 1.9. Playing with Asteroids
        10. 1.10. Source code
        1. 1.11. Summary
    8. 2. The first program: Little Crab
        1. 2.1. The Little Crab scenario
        2. 2.2. Making the crab move
        3. 2.3. Turning
          1. Side note: Errors
        4. 2.4. Dealing with screen edges
        1. 2.5. Summary of programming techniques
    9. 3. Improving the Crab—more sophisticated programming
        1. 3.1. Adding random behavior
        2. 3.2. Adding worms
        3. 3.3. Eating worms
        4. 3.4. Creating new methods
        5. 3.5. Adding a Lobster
        6. 3.6. Keyboard control
        7. 3.7. Ending the game
        8. 3.8. Adding sound
        1. 3.9. Summary of programming techniques
    10. 4. Finishing the crab game
        1. 4.1. Adding objects automatically
        2. 4.2. Creating new objects
        3. 4.3. Animating images
        4. 4.4. Greenfoot images
        5. 4.5. Instance variables (fields)
        6. 4.6. Assignment
        7. 4.7. Using actor constructors
        8. 4.8. Alternating the images
        9. 4.9. The if/else statement
        10. 4.10. Counting worms
        11. 4.11. More ideas
        1. 4.12. Summary of programming techniques
    11. 1. Sharing your scenarios
        1. I1.1. Exporting your scenario
        2. I1.2. Export to application
        3. I1.3. Export to a web page
        4. I1.4. Publishing on the Greenfoot Gallery
    12. 5. Making music: An on-screen piano
        1. 5.1. Animating the key
        2. 5.2. Producing the sound
        3. 5.3. Abstraction: Creating multiple keys
        4. 5.4. Building the piano
        5. 5.5. Using loops: The while loop
        6. 5.6. Using arrays
        1. 5.7. Summary of programming techniques
    13. 6. Interacting objects: Newton’s Lab
        1. 6.1. The starting point: Newton’s Lab
        2. 6.2. Helper classes: SmoothMover and Vector
        3. 6.3. The existing Body class
        4. 6.4. First extension: Creating movement
        5. 6.5. Using Java library classes
        6. 6.6. Adding gravitational force
        7. 6.7. The List type
        8. 6.8. The for-each loop
        9. 6.9. Applying gravity
        10. 6.10. Trying it out
        11. 6.11. Gravity and music
        1. 6.12. Summary of programming techniques
    14. 7. Collision detection: Asteroids
        1. 7.1. Investigation: What is there?
        2. 7.2. Painting stars
        3. 7.3. Turning
        4. 7.4. Flying forward
        5. 7.5. Colliding with asteroids
        6. 7.6. Casting
        7. 7.7. Adding fire power: The proton wave
        8. 7.8. Growing the wave
        9. 7.9. Interacting with objects in range
        10. 7.10. Further development
        1. 7.11. Summary of programming techniques
    15. 2. The Greeps competition
        1. I2.1. How to get started
        2. I2.2. Programming your Greeps
        3. I2.3. Running the competition
        4. I2.4. Technicalities
    16. 8. Creating images and sound
        1. 8.1. Preparation
        2. 8.2. Working with sound
        3. 8.3. Sound recording and editing
        4. 8.4. Sound file formats and file sizes
        5. 8.5. Working with images
        6. 8.6. Image files and file formats
        7. 8.7. Drawing images
        8. 8.8. Combining images files and dynamic drawing
        1. 8.9. Summary
    17. 9. Simulations
        1. 9.1. Foxes and rabbits
        2. 9.2. Ants
        3. 9.3. Collecting food
        4. 9.4. Setting up the world
        5. 9.5. Adding pheromones
        6. 9.6. Path forming
        1. 9.7. Summary
    18. 10. Additional scenario ideas
        1. 10.1. Marbles
        2. 10.2. Lifts
        3. 10.3. Boids
        4. 10.4. Circles
        5. 10.5. Explosion
        6. 10.6. Breakout
        7. 10.7. Platform jumper
        8. 10.8. Wave
        1. 10.9. Summary
    19. A. Installing Greenfoot
        1. A.1. Installing Java
        2. A.2. Installing Greenfoot
        3. A.3. Installing the book scenarios
    20. B. Greenfoot API
    21. C. Collision detection
        1. C.1. Method summary
        2. C.2. Convenience methods
        3. C.3. Low versus high resolution
        4. C.4. Intersecting objects
        5. C.5. Objects at offset
        6. C.6. Neighbors
        7. C.7. Objects in range
    22. D. Some Java details
        1. D.1. Java data types
          1. D.1.1. Primitive types
          2. D.1.2. Object types
        2. D.2. Java operators
          1. D.2.1. Arithmetic expressions
          2. D.2.2. Boolean expressions
        3. D.3. Java control structures
          1. D.3.1. Selection statements
            1. D.3.1.1. if-else
            2. D.3.1.2. switch
          2. D.3.2. Loops
            1. D.3.2.1. while
            2. D.3.2.2. do-while
            3. D.3.2.3. for

Product information

  • Title: Introduction to Programming with Greenfoot: Object–Oriented Programming in Java™ with Games and Simulations, First Edition
  • Author(s): Michael Kölling
  • Release date: August 2009
  • Publisher(s): Pearson
  • ISBN: 9780132773140