Task 2, Arrive
locate the class test.ArriveScenario. If you run it, you will see one car and a green dot. Your task is to create a new controller (create a class "controllers.ArriveController") that receives a GameObject, "target", in the constructor, and that controls the car to "Arrive" to the "target" using the "Arrive" steering behavior. Apply this controller to "car1".
빨간 자동차를 움직여서 target인 녹색원을 향해 가도록 만드는 것
▶ 처음 주어진 ArriveScenario
package test;
import controllers.EmptyController;
import controllers.KeyboardController;
import engine.Car;
import engine.Game;
import engine.GameObject;
import engine.GameWindow;
import engine.Marker;
import engine.Obstacle;
import java.awt.Color;
/**
*
* @author santi
*/
public class ArriveScenario {
/*
Goal of this exercise:
- Write a controller for "car1" that uses the "Arrive" steerig behavior to arrive to
a given marker.
- To make sure it works, test your controller by placing the marker in different positions
in the map.
*/
public static void main(String args[]) throws Exception {
Game game = new Game(800,600, 25);
// set up the outside walls:
game.add(new Obstacle(0,0,800,25,Color.GRAY));
game.add(new Obstacle(0,575,800,25,Color.GRAY));
game.add(new Obstacle(0,0,25,600,Color.GRAY));
game.add(new Obstacle(775,0,25,600,Color.GRAY));
// set up the cars and markers:
GameObject marker = new Marker(600,300,10, Color.green);
GameObject car1 = new Car("graphics/redcar.png",200,300,-Math.PI/2, new EmptyController());
game.add(marker);
game.add(car1);
GameWindow.newWindow(game);
}
}
* 참고 문서 (숙제링크)
https://www.cs.drexel.edu/~so367/teaching/2017/CS387/projectSteering.htm
Steering_Task_Arrive1.zip
0.04MB
'Game AI & Unity > Java Steering game' 카테고리의 다른 글
[Game AI][Steering Behavior] Task_Arrive (controllers.ArriveController) (0) | 2024.03.21 |
---|---|
[Game AI][Steering Behavior] Task_Arrive (test.ArriveScenario) (0) | 2024.03.21 |
[Game AI][Steering Behavior] 19. Task_Seek (0) | 2024.03.21 |
[Game AI][Steering Behavior] 18. Task_Seek (controllers.SeekController) (0) | 2024.03.20 |
[Game AI][Steering Behavior] 17. Task_Seek (test.SeekScenario ) (0) | 2024.03.20 |