Announcements

March 10, 2018

EXPO! Today

Today is a good day to thoroughly test any project work you want to show today. Find someone who would like you to try out their game, or invite someone to try out yours. Before you add any finishing touches, make sure you save a working version. You could also work on some CodingBat exercises.

Going Further

Here are resources to explore for more advanced work with Greenfoot and Java:

March 3, 2018

EXPO! is next week. At that time, you can show any of your project work or CodingBat work. We'll have time next week for finishing touches on projects or additional CodingBat exercises, but you should try to have the bulk of your work done today.

February 24, 2018

Maintaining focus

It can be difficult to maintain focus for extended periods of time. One approach to overcoming this problem is called the Pomodoro method.

FAQs

Zach (AM Class): How can I have it where when My character touches another actor a new screen comes up?

Download this scenario to see two ways to generate a new screen.

Adrian (AM Class) I was wondering how you make an actor shoot multiple projectiles in different directions at once.

The videos below explain shooting.

Thanks to Alex for sharing these funnies:

February 17, 2018

FAQs

Jet (AM Class): What's wrong with the image I'm using in Avoider Game?

In general, background images should be the same size as your world. If the image is smaller than the world, the background image is tiled in the background of the world.

For the Avoider Game, these images should work for you.

Evan (PM Class): I was wondering if there was a way I could export it as a .exe so I could brag to my friends that I made and game and send it to them.

To learn how to share Greenfoot games, see the video below:

Rohan (AM Class): Why does the ColorSniffer goes half through the wall and then stop? Pretty sure it just tests for middle of the character, not the whole character.

You're right. The ColorSniffer that I posted earlier just uses the getColorAt method in the GreenfootImage class to get the color at one particular point in the background--the point at the ColorSniffer's (x,y) coordinates. For Actors, getX() and getY() give the x and y coordinates of the center of the Actor's image.

Download Maze2.0x for a version of the Maze program that checks to see if the wall color is anywhere under the bounding box of the ColorSniffer's image. Open up the code for the ColorSniffer class and scroll down to the bottom to see the changes that make use of the bounding box.

You'll also find a couple of subclasses added (the "x" in Maze2.0x is for "eXtended"). The subclasses inherit behaviors from the ColorSniffer class and extend them by adding keyboard control (ColorBumper) or random movement (ColorEnemy).

Zach (AM Class): How can I use strings to have my player and an actor have a conversation?

Here are examples of a conversation between an actor and a player, and a conversation between two actors. Use the Act button instead of the Run button for both.

February 10, 2018

MacOS: keyboard glitches / certain keys stop working

On recent versions of MacOS, certain keys may seem to occasionally stop working temporarily or permanently (until Greenfoot is restarted). This is due to the "press-and-hold for accented characters" functionality in MacOS interfering with regular keyboard input.

The solution is to disable this functionality, which can only be done via the Terminal application. Open it and enter the following command:

defaults write -g ApplePressAndHoldEnabled -bool false

To re-enable the press-and-hold functionality, use this command:

defaults write -g ApplePressAndHoldEnabled -bool true

Unfortunately, there is no way to disable this function just for Greenfoot — turning it on or off affects all applications.

Today, we'll try to set aside time for Avoider Game, CodingBat, Quizlet Live, and some independent project work. I added some video to answer some of the FAQs I've gotten in the last couple of weeks. They might come in handy for your individual work.

FAQs

Adrian (AM class): How can an actor detect a wall?

Here is the image I used for the maze background:

Zach (AM class): How can one actor can remove another actor from the world?

Using the Animal class

Predator/Prey 1

If you'd like a peek at the code in the Animal class, watch the video below:

Predator/Prey 2

Zach (AM class): How can I make a title screen?

Creating the title screen

Title Screen 1

Managing the title screen and play screen

Title Screen 2

Zach (AM class): How can I set add my own images and set them to the actor's image?

Once you have an image file with the image you want, setting the image of your actor is easy.

My Own Image 1

If an image isn't the right size, you can use code to resize it in Greenfoot.

My Own Image 2

Zach (AM class): How can I display information about collisions?

Counting Collisions 1

Counting Collisions 2

Counting Collisions 3

Alex (AM class): I want to continue my Sandbox game.

February 3, 2018

So far, we've gotten down the basics of Java and Greenfoot, and I've seen some interesting starts on games.

I'd like you guys to have some free time today develop your games further or do some more CodingBat practice. However, to improve your coding skils and start or further develop your games, we need to take some time to go deeper into Greenfoot first.

To do that, we'll spend our first hour or so on the Avoider Game, using a programming strategy called pair programming.

Do's and Don'ts of Pair Programming

Remember the Do's and Don'ts explained in the video:

Do

1. Talk
2. Listen
3. Rotate Roles
4. Be Patient
5. Respect
6. Take Breaks
7. Prepare
8. Clean
9. Have Fun

Don't

1. Be Bossy
2. Be Intimidated
3. Be Quiet
4. Suffer in Silence

Avoider Game

It does not matter how slowly you go as long as you do not stop. ― Confucius

Our pair programming task for today is Avoider Game Part 1. The Navigator should have the web page open in front of him. The Driver should create the scenario.

For the AM class, we'll randomly pick partners with the student shuffle scenario.

Independent Work Period

When you have finished pair programming (Avoider Game Part 1), you can do any of the following:

1. Explore Greenfoot further by following links below:
2. Work on a game of your own
3. Continue with CodingBat

January 27, 2018

FAQs

I got some questions in last week's reflections:

• Jet (AM class) and Evan (PM class) wanted to know how to display answers to questions that are asked by an Actor.
• Alex (AM class) is interested in creating a Greenfoot version of a program he wrote in Scratch. It's a sandbox game with tools on a hotbar that users can select and place in
• Zach (AM class) wanted to know how to set up a scenario when the user presses the Run button.

CodingBat

Continue working on String-1. If you finish that, go on to Logic-1.

Java Concept Review

Are you ready for Quizlet live?

Independent work time

During independent work time, you can work on CodingBat, review Java concepts to get ready for Quizlet live, or work on a project idea of your own.

Pair Programming

We'll watch a video on pair programming today and practice pair programming with the Avoider Game. If you've already done work on Avoider, let me know where you're at with it.

January 20, 2018

Setting up

Students will need email addresses to sign in to CodingBat and submit reflections. Send an email message to tj@tjleone.com with JAGD in the subject line.

We'll introduce ourselves, discuss bathrooms, snacks and other important matters, and take a survey.

The main reason for the survey I'm giving is to make sure you're getting work that's the right level of challenge for you. You'll also have the opportunity to email reflections to me at end of each class to let me know how things are going. If you're feeling overwhelmed, I'll provide more background material. If you're feeling bored, I'll find you some work at a higher level of challenge.

We will spend a significant amount in independent work periods. There may be specific tasks that need to be completed, or there may be different choices depending on where you're at in your work.

If it looks like you don't have anything to do, I'll check in with you, but you don't have to wait for me. When you finish one activity and you're not sure what to do next, look on this announcements page. Find something that will help you develop as a programmer. If you need help figuring that out, ask.

Surveys

If your class meets from noon to 2:30pm, take the PM Student Survey.

Java Review

The videos below discuss the things you need to know about return types, parameters, and Strings for today's CodingBat activities. If you're already comfortable with this material, you can skip down to the CodingBat video.

Not sure if you're comfortable? You can review the material anyway, or skip down to the CodingBat video and try out CodingBat. You can always come back to the review material if you need to.

Return types and parameters

Notice the download link below this video. You'll get best results from the video if you download the scenario and code along with me while you watch the videos.

Greenfoot

If need a review of basic game programming in Greenfoot, check out these tutorials:

Java Concept Review

If we have time, we'll play Quizlet live when you're done reviewing the material.