The teacher downloads the latest version of the project:
· From Moodle platform
· Fromgit repository
The teacher creates and places an Enemy class object somewhere on the board. It explains some methods of the Actor class:
· move(int)
· turn(int)
· setRotation()
While explaining the methods, the teacher also shows how certain properties of the class are changed (for example, the position of the object on the board, ie the x and y values). The teacher discusses with the students how to supplement the act() method so that every time the act() method is called, the Enemy class object should move two steps forward.
The teacher creates an instance of the Enemy class and places it in the center of the board. The teacher opens a window with the internal state of the instance and positions it so that it is visible while the application is running. Then run the application and observe how the values of the x, yandrotationattributes in the Enemyclass change when call different methods. How do these values change as you move (up, down, left, and right) and turn?
The teacher put an instance of the Enemy class on the World, and an instance of the Direction class in the same row. The teacher adds code to the act() method so that the object moves one step forward.
The teacher explains to the students how to determine whether two or more objects ("characters") on the World are in the same position (on the same cell). The teacher explains the method: isTouching().
The teacher and students modify the act() method of the Enemy class to ensure that the enemy rotates 90° clockwise when it is in the same cell that contains an instance of the Direction class.
Together with the students, the teacher observes what happens with the rotation attribute.