We now have full functionality like we did in Ray-Tracing-2. It's time to begin adding features.
This commit is contained in:
@@ -1,17 +1,60 @@
|
||||
import processing.core.PApplet;
|
||||
import processing.core.PVector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Processing extends PApplet {
|
||||
|
||||
Car car;
|
||||
ArrayList<Wall> objects = new ArrayList<Wall>();
|
||||
|
||||
public static PApplet processing;
|
||||
|
||||
public static void main(String[] args) {
|
||||
PApplet.main("Processing");
|
||||
}
|
||||
|
||||
public void settings(){
|
||||
size(200, 200);
|
||||
processing = this;
|
||||
car = new Car(processing, 100,100,50,40);
|
||||
size(1000, 1000);
|
||||
car.addView(60,6);
|
||||
for(int i = 0; i < 20; i++){
|
||||
Wall wall = new Wall(processing, new PVector((int)random(40, 1840), (int)random(40, 960)), (int)random(360), (int)random(100, 1000));
|
||||
objects.add(wall);
|
||||
}
|
||||
}
|
||||
public void draw(){
|
||||
background(0);
|
||||
ellipse(mouseX, mouseY, 20, 20);
|
||||
for(Wall object : objects){
|
||||
object.drawWall();
|
||||
}
|
||||
car.drawCar(objects);
|
||||
//car.drive(new int[] {0, 0});
|
||||
}
|
||||
|
||||
public void keyPressed(){
|
||||
if(key == 'd'){
|
||||
car.setPose(car.getPose().add(1, 0));
|
||||
}
|
||||
if(key == 'w'){
|
||||
car.setPose(car.getPose().add(0, -1));
|
||||
}
|
||||
if(key == 'a'){
|
||||
car.setPose(car.getPose().add(-1, 0));
|
||||
}
|
||||
if(key == 's'){
|
||||
car.setPose(car.getPose().add(0, 1));
|
||||
}
|
||||
if(key == 'q'){
|
||||
car.setAngle(car.getAngle()+1);
|
||||
}
|
||||
if(key == 'e'){
|
||||
car.setAngle(car.getAngle()-1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user