суботу, 14 листопада 2020 р.

Java4Kids 5. Team Spirit

I should say that I'm pleased with today's lesson. It started as usual, from fixing student's code that doesn't compile. This time I was cheered up when one student needed just a bit of my help, and then he made almost everything on his own. And that's not it.


What Can Make a Lesson Happy?

This time we were writing the end of the game. No, it's not that we did everything we planned. We just wrote "You WIN" and "You LOOSE" screens and logically connected them. Now our product has finished look. This made me and all the students HAPPY. At the end of the lesson, we said goodbye feeling accomplishment. 

Let's sum up what we did in each lesson.

1 - Get to know each other; see a bit of Greenfoot; Java and OOP main points; ant moves.

2 - How objects are created in Greenfoot; create Pear - food, Grass - house; hide pear when brought home.

3 - Create Food-apple as a parent of the Pear; mark a different weight of the Pair and the Apple classes; the Ant can carry only light objects (apples). 

4 - Add possibility for the Ant to get more powers when eating Food and so the ability to carry heavy foods; created score counters on the screen.

5 - Created AntEaters and Game Over screens, its logic.

What shall we do at the next and last lesson? Polish our features, add minor nice-to-haves, share the project.

Here is the link to the project with code. Go and try to win!



What can make a lesson pleasant for a teacher?

The best award for a teacher is when his students show they understand the subject and all the given information is accepted and processed. 

Yes. I had it. After the student questioned the problem in his new code, he didn't stop the screen share. As a result, we developed a substantial feature on his computer with his hands. 

Amazing that it wasn't just me advising what to do and how to do it, but other students also were involved. One thing is when a teacher shows the feature and another when your student-partner acts instead. Anyone could be in his place. The fortune of the common game is in the hands of another boy. The rest of the team was much more involved compared to when listening to just me.


What can pull a children's team together when online?

Working on a common thing makes people a team. Common success made children more active and easygoing. When they were told that the next lesson would be the last, everyone started saying what else they wanted to implement to make our game more interesting and fun. 

I'm happy that everything worked out so well! 


Code from the lesson

import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

public class AntEater extends Actor

{

    public void act() 

    {

        move(4);

        if(Greenfoot.getRandomNumber(10) < 1){

            turn(Greenfoot.getRandomNumber(15)-30);

        }

        eatAnt();

    }    

    

    public void eatAnt(){

        if(isTouching(Ant.class)){

            removeTouching(Ant.class);

            getWorld().showText("YOU LOOSE", 

                getWorld().getWidth()/2, getWorld().getHeight()/2);

        }

    }

}

-----------------------------
Class Food, updated method
...
public void disappear(){
        Grass.hasFood += this.weight;
        foodAmount -= 1;
        if(foodAmount == 0){
            getWorld().removeObject(getOneIntersectingObject(Ant.class));
            getWorld().showText("YOU WIN", 
                    getWorld().getWidth()/2, getWorld().getHeight()/2);
        }
        getWorld().removeObject(this);
    }  
...

Немає коментарів:

Дописати коментар