52 lines
998 B
Java
52 lines
998 B
Java
|
|
/**
|
|
* Klasse game.
|
|
*
|
|
* @author
|
|
*/
|
|
import java.util.*;
|
|
import processing.core.PApplet;
|
|
public class Game extends PApplet{
|
|
/*---------------Attribute-----*/
|
|
int cellSize = 40;
|
|
Render render;
|
|
Pacman pacman;
|
|
|
|
int[][] wall;
|
|
/*---------------Konstruktor---*/
|
|
public Game() {
|
|
String[] processingArgs = {"MySketch"};
|
|
PApplet.runSketch(processingArgs, this);
|
|
render = new Render(this);
|
|
pacman = new Pacman(this);
|
|
populateWalls();
|
|
}
|
|
|
|
/*---------------Methoden------*/
|
|
|
|
public void settings() {
|
|
size(10 * cellSize, 10 * cellSize);
|
|
}
|
|
|
|
|
|
public void draw() {
|
|
background(0);
|
|
pacman.draw();
|
|
}
|
|
|
|
public void keyPressed() {
|
|
pacman.keyPressed(keyCode);
|
|
}
|
|
|
|
public boolean wantMove() {
|
|
return true;
|
|
}
|
|
|
|
public void populateWalls(){
|
|
wall = new int[][]{
|
|
{0, 0, 0, 1},
|
|
{0, 1, 1, 1},
|
|
};
|
|
}
|
|
}
|