Teamwork is essential; it allows you to blame someone else. — Finagles’ 8th Rule
One of the frequently asked questions is how to display text in Greenfoot scenarios. Today I’ll answer that question.
I discuss two things: How to display some static text (text that does not change, such as instructions), and how to display text that should change during the program run. We’ll do that by making our own score counter.
We learn wisdom from failure much more than from success. We often discover what will do, by finding out what will not do; and probably he who never made a mistake never made a discovery. — Samuel Smiles
We’re talking about errors today. I’m sure you all have – like me – got your fair share of errors when you were programming. I’ll talk a bit about how to go about investigating what went wrong when you get an error.
In doing this, we’re discussing the important distinction of synax errors and semantic errors, and we’re learning to deal with both. This includes reading stack traces.
The ideals which have lighted me on my way and time after time given me new courage to face life cheerfully, have been Truth, Goodness, and Beauty. . . . The ordinary objects of human endeavour — property, outward success, luxury — have always seemed to me contemptible. — Albert Einstein
One more quick one about image effects: a smoke effect to be precise. I’ll show you how to create this really cool effect just with what you know already. Hopefully, this will give you some ideas of more cool effects that you can do on your own.
A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort. — attributed to Herman Oliver Albright
A last little bit before we leave our coloured circles behind: an animation. In this case, it’s a very simple one: fading out the circles. But it shows an important technique: The appearance of an actor can change all the time, if we want to. This is the basis for many visual effects.
And, we finally see an if-statement with an else clause! I can’t believe that it took this long for this to pop up.
We are accustomed to see men deride what they do not understand, and snarl at the good and beautiful because it lies beyond their sympathies. — Goethe
Okay, time to get a little more professional again: Let’s clean up our code a little.
Writing in good style is really important, so today I’ll show you a bit about refactoring. Especially, we want to create short, clear methods. (The technical term for it is cohesion – we want highly cohesive methods.)
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.
Even if you’re not that interested in discussion of underlying concepts, but just want to GET STUFF DONE — still, watch this video. You can only become a good programmer (and get stuff done) if you understand what you’re doing.
I really want you not only to copy what I’m showing you, but become able to invent and create your own programs. For this, it’s important to get the concepts.
So, hit start, sit back for a few minutes, and learn something!