Introduction to Programming with Greenfoot Object Oriented Programming in Java with Games and Simulations 1st Edition Michael Kolling - The full ebook version is available, download now to explore
Introduction to Programming with Greenfoot Object Oriented Programming in Java with Games and Simulations 1st Edition Michael Kolling - The full ebook version is available, download now to explore
or textbooks at https://ebookultra.com
_____ Follow the link below to get your download now _____
https://ebookultra.com/download/introduction-to-programming-
with-greenfoot-object-oriented-programming-in-java-with-
games-and-simulations-1st-edition-michael-kolling/
https://ebookultra.com/download/an-introduction-to-object-oriented-
programming-with-visual-basic-net-1st-edition-dan-clark/
https://ebookultra.com/download/introduction-to-programming-with-
java-3rd-edition-john-dean/
https://ebookultra.com/download/java-the-uml-way-integrating-object-
oriented-design-and-programming-else-lervik/
https://ebookultra.com/download/applying-uml-and-patterns-an-
introduction-to-object-oriented-programming-2ed-edition-larmen/
Object Oriented Design with UML and Java 1st Edition
Kenneth Barclay
https://ebookultra.com/download/object-oriented-design-with-uml-and-
java-1st-edition-kenneth-barclay/
https://ebookultra.com/download/object-oriented-programming-in-c-4th-
edition-e-balagurusamy/
https://ebookultra.com/download/java-methods-object-oriented-
programming-and-data-structures-third-ap-3rd-ap-edition-maria-litvin/
https://ebookultra.com/download/beginning-c-object-oriented-
programming-2nd-edition-dan-clark/
https://ebookultra.com/download/practical-database-programming-with-
java-1st-edition-ying-bai/
Introduction to Programming with Greenfoot Object
Oriented Programming in Java with Games and
Simulations 1st Edition Michael Kolling Digital Instant
Download
Author(s): Michael Kolling
ISBN(s): 9780136037538, 0136037534
Edition: 1
File Details: PDF, 5.44 MB
Year: 2009
Language: english
Introduction to Programming with Greenfoot
Companion Website
Additional material and resources for this book can be found at
http://www.greenfoot.org/book/
For students:
G The Greenfoot software
G Tutorial videos
G A discussion forum
G Technical support
For teachers:
G A teacher discussion forum
resources
This page intentionally left blank
Introduction to
Programming with
Greenfoot
Object-Oriented Programming in Java™
with Games and Simulations
Michael Kölling
Prentice Hall
Upper Saddle River • Boston • Columbus • San Francisco • New York
Indianapolis • London • Toronto • Sydney • Singapore • Tokyo • Montreal • Dubai
Madrid • Hong Kong • Mexico City • Munich • Paris • Amsterdam • Cape Town
Vice President and Editorial Director, ECS: Marcia J. Horton
Editor in Chief, CS: Michael Hirsch
Executive Editor: Tracy Dunkelberger
Assistant Editor: Melinda Haggerty
Editorial Assistant: Allison Michael
Director of Team-Based Project Management: Vince O’Brien
Senior Managing Editor: Scott Disanno
Production Liaison: Irwin Zucker
Production Editor: Shiny Rajesh, Integra
Senior Operations Specialist: Alan Fischer
Operation Specialist: Lisa McDowell
Marketing Manager: Erin Davis
Marketing Coordinator: Kathryn Ferranti
Art Director: Jayne Conte
Cover Designer: Bruce Kenselaar
Art Editor: Greg Dulles
Media Editor: Daniel Sandin
Composition/Full-Service Project Management: Integra
Copyright © 2010 by Pearson Higher Education. Upper Saddle River, New Jersey, 07458. All rights
reserved. Manufactured in the United States of America. This publication is protected by Copyright and
permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval
system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or
likewise. To obtain permission(s) to use materials from this work, please submit a written request to Pearson
Higher Education, Permissions Department, 1 Lake Street, Upper Saddle River, NJ 07458.
The author and publisher of this book have used their best efforts in preparing this book. These efforts
include the development, research, and testing of the theories and programs to determine their effectiveness.
The author and publisher make no warranty of any kind, expressed or implied, with regard to these programs
or the documentation contained in this book. The author and publisher shall not be liable in any event for
incidental or consequential damages in connection with, or arising out of, the furnishing, performance,
or use of these programs.
10 9 8 7 6 5 4 3 2 1
ISBN-13: 978-0-13-603753-8
ISBN-10: 0-13-603753-4
To Krümel and Cracker—may their imagination never fade.
—mk
Introduction 1
Appendix
A Installing Greenfoot 163
B Greenfoot API 165
C Collision detection 169
D Some Java details 175
Index 185
List of scenarios discussed
in this book
Asteroids 1 (Chapter 1)
This is a simple version of a classic arcade game. You fly a spaceship through space and try to
avoid being hit by asteroids. At this stage, we only use the scenario to make some small changes
and illustrate some basic concepts.
Piano (Chapter 5)
An on-screen piano that you can really play.
Asteroids 2 (Chapter 7)
We come back to the asteroids example from Chapter 2. This time, we investigate more fully
how to implement it.
Ants (Chapter 9)
A simulation of ant colonies searching for food, communicating via drops of pheromones left on
the ground.
The following scenarios are presented in Chapter 10 and selected aspects of them briefly
discussed. They are intended as inspiration for further projects.
Marbles
A simulation of a marble board game. Marbles have to be cleared of the board within a limited
number of moves. Contains simple physics.
xii | List of scenarios discussed in this book
Lifts
A start of a lift simulation. Incomplete at this stage—can be used as a start of a project.
Boids
A demo showing flocking behavior: A flock of birds flies across the screen, aiming to stick
together while avoiding obstacles.
Circles
Make patterns in different colors on the screen with moving circles.
Explosion
A demo of a more sophisticated explosion effect.
Breakout
This is the start of an implementation of the classic Breakout game. Very incomplete, but with
an interesting visual effect.
Platform jumper
A demo of a partial implementation of an ever-popular genre of games: platform jumpers.
Wave
This scenario is a simple demonstration of a physical effect: the propagation of a wave on
a string.
Preface | xiii
Preface
Greenfoot is a programming environment that can be used by individuals, in schools or in
introductory university courses to learn and teach the principles of programming. It is flexible
enough to be suitable for teenagers as well as older students.
Greenfoot supports the Java Programming Language, so students learn standard object-oriented
programming in Java. The environment is designed specifically to convey object-oriented con-
cepts and principles in a clean, easily accessible manner.
The Greenfoot environment makes creation of graphics and interaction easy. Students can
concentrate on modifying the application logic, and engage and experiment with objects.
Developing simulations and interactive games becomes easy, and feedback is immediate.
The environment is designed to quickly engage students who may have no prior interest or experi-
ence in programming. Achieving simple animation results is quick, sophisticated, professional
looking scenarios are possible.
Title: My Rubaiyat
Language: English
I will drop the mask and tell you the secret of my verses. You say
they impress you as being uneven and unfinished. I heartily agree
with you. As I have stated in my announcement to the public, a
poem of the scope and range of “My Rubaiyat” is never complete.
No doubt, it will undergo many changes within the next ten years. I
say ten years deliberately. You see, I possess the arrogance of
conviction. I believe it will survive, simply because it strikes a
popular chord, and attempts, no matter how vaguely, to reproduce a
broken melody that hums in every mind. Somebody else may
venture forth on similar paths and succeed to please even the
fastidious in rhyme. “My Rubaiyat” may be put on the back shelves.
Well, we will see. I look at my work with objective eyes. It is a mere
youngster now. It will grow and nobody will watch its growth with
keener appreciation than I myself. The number of verses will not
increase, but I sincerely hope that they will gain in clarity and
strength as well as in musical and pictorial wealth of expression.
As for versification, let me make this explanation. I chose the
eight syllable stanza on account of its terseness of expression. It is
least pliable to any rush and swing of rhythm, but most conducive to
the conveyance of fragmentary moods and thoughts. The omission
of rhyme I essayed for no other reason than its technical difficulty.
To make rhymeless lines read like a poem is the most laborious task
a songsmith can set himself. It is the vanity of the alien to show his
mastery over a language that was neither his father’s nor his
mother’s tongue. But I object to your statement that I disdain
rhythm. I have a vague suspicion that you really mean meter. My
meter is rough and wilful and subject to impurities, as for instance
counting the last two syllables in words like “happier” and “sunnier”
either as one or two, just as my fancy, or rather my appreciation of
rhythm, dictates. My rhythm changes constantly but it is palpable,
underneath as it were, at all times. I have some experience as a
reader (though elocutionists may shrug their shoulders at my style of
interpretation—let them shrug) and I have, whenever I write, the
habit of reading aloud the words as I put them down. Reading
means to get a certain sense and swing, color and sound in the
words as one utters them. If my verses contain this possibility of
aural gratification they cannot be utterly devoid of rhythm. No doubt
my sense of sound alliteration is foreign, unconsciously Oriental. I
feel a sound relation, no, even a rhyme suggestion in words like
“chance” and “spring,” “herd” and “feet” at the end of succeeding
stanzas. The alliteration of Japanese poets is much subtler (due to
the peculiarities of the language) than the word music of our Laniers
and Whitmans, although it is never conducted with the elaborate
precision of a Poe or Swinburne. It always remains fragmentary, it
rarely resembles full orchestration. Also my lines lack the merit of
contrapuntal structure. Yet they have one quality which is generally
overlooked. They possess pictorial harmony. My long and persistent
association with art makes me not only see but think things in
pictures. Pictures abound throughout “My Rubaiyat” for all who have
the mental pictorial vision to see them. Lines like “turn phantoms
with the colder morn” and “in a hilltown among roses” are as
concentrated as any image that can be found in a tanka (i.e.
Japanese short poem).
Critics may contend that pictorial suggestion per se, as the main
characteristic of a poem, does not conform to the accepted forms of
poetry. This objection is meaningless to me. Without the spirit of
innovation there would have been no incentive to write the poem.
Like the composers of the day I believe in the old ideals but in new
methods of expression.
My ambition was to write a simple poem which would appeal to
all; to chambermaids as well as cognoscenti, ordinary business men
as well as solitary artistic souls. Who will decide whether I have
succeeded or failed? Only the public at large. The poem, no doubt, is
too didactic for fragile aesthetics who glorify naught but evanescent
words, but it is surely no shortcoming to try to express thought.
Even exponents of the modern schools attempt this—occasionally.
The way of expression is a different matter. It is open to criticism.
But excuses that a critic knows nothing about a certain subject, and
yet at the same time deliberate pricks at this very thorn in the flesh
of his ignorance are sad to contemplate. Rhyme is surely out of
date. And the supposed lack of rhythm is merely imaginary. Would
you enjoy Japanese or Chinese music? Very likely not and yet they
contain as fine a rhythm and as musical a quality as any modern
composition. Only they are vaguer, subtle, different.
And on this difference hinges all logical and evasive argument.
The practical philosophy contained in “My Rubaiyat,” of course, can
be attacked for being non-moral or non-religious, but the technique
of the poem can be discussed only from one viewpoint.
Sincerely yours,
Sadakichi Hartmann.
MY RUBAIYAT
I.
What should we dream, what should we say,
On this drear day, in this sad clime!
In the garden the asters fade,
Smoke of weed-fires blurs the plain,
The hours pass with a sullen grace—
Can we be gay when skies are grey!
II.
Would joy prove a more steady guest,
In palm-girt, sunnier Southern lands,
Some lambient world of green and gold
Fanned by the charm of Orient lay!
’Tis vain delusion thus to think
That life will change with change of scene.
III.
Man cannot get away from facts—
Alas, stern duty looms supreme,
For certain things we must perform,
Obey the inward voices’ call.
Calm joyous days cannot be wooed
Unless our conscience is at peace.
IV.
Life is to most a weary task,
A ceaseless strife for daily bread,
We cannot act as we would like,
We cannot gain for what we strive.
To bear the burden cheerfully
Is all this earth allows to us.
V.
Our tired soul with faint forced smile
But rarely scales the loftier themes,
Fair Hafiz and Anacreon
Have they drunk, laughed and sung in vain!
Do grove and grange no longer yield
The idyls of Theocritus!
VI.
Was man once happier than now?
Who is there to tell the story
Of slaves or Cesars of the past?
Still our blood is stirred each spring,
Still books and music make us dream,
Why mourn the “snows of yesteryear?”
VII.
There were ever some more favored
Who care-free basked in fortune’s sun.
The rest did toil. And you and I?
We hear the same recurrent rhymes,
Like changing seasons, night and day,
We simply come, sojourn, and go.
VIII.
We enter the world unbidden,
Plod along roads as we know best.
One is born rich, the other poor,
Who knows what helps a mortal most.
Ere sleep we rub from our eyes
We are forever what we are.
IX.
The laughter of childhood is gone,
The toy castles we built are lost—
Can we redeem in future days
The disappointments of the past!
Our nursery songs will they change
Into jubilant songs of love!
X.
Light-headed youth, all smiles around
In dew-drenched gardens of spring morns
No heed takes of the dial’s stealth.
Youth wants to conquer—rule the spheres,
While the sun runs his ruthless course
And shadows begin to lengthen.
XI.
In open woods some summer night,
The sound of the wind in the leaves—
Two vagrant lovers hand in hand—
O’er treetops the errant moon.
Oh, this mad desire to possess!
To waste the soul on blood-red lips.
XII.
Sex is a power all cherish,
We worship it on bended knees,
Like old wine it yields the magic
Of oblivion and ecstasies,
The moments drift on golden clouds
To regions of the white beyond.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookultra.com