walls render
This commit is contained in:
parent
6abf958133
commit
3387848daa
BIN
Render.class
BIN
Render.class
Binary file not shown.
12
Render.ctxt
12
Render.ctxt
@ -4,8 +4,10 @@ comment0.text=\r\n\ Klasse\ render.\r\n\ \ \r\n\ @author\ \r\n
|
||||
comment1.params=game
|
||||
comment1.target=Render(Game)
|
||||
comment1.text=---------------Konstruktor---
|
||||
comment2.params=x\ y\ r\ g\ b\ visible
|
||||
comment2.target=void\ drawGhost(int,\ int,\ int,\ int,\ int,\ boolean)
|
||||
comment3.params=x\ y\ open
|
||||
comment3.target=void\ drawPacman(int,\ int,\ boolean)
|
||||
numComments=4
|
||||
comment2.params=wall
|
||||
comment2.target=void\ drawWall(int[])
|
||||
comment3.params=x\ y\ r\ g\ b\ visible
|
||||
comment3.target=void\ drawGhost(int,\ int,\ int,\ int,\ int,\ boolean)
|
||||
comment4.params=x\ y\ open
|
||||
comment4.target=void\ drawPacman(int,\ int,\ boolean)
|
||||
numComments=5
|
||||
|
||||
16
Render.java
16
Render.java
@ -15,7 +15,19 @@ public class Render {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void drawWall(int [] wall){
|
||||
if(wall[0] == wall[2]){
|
||||
game.strokeWeight(4);
|
||||
game.stroke(255,255,0);
|
||||
game.line(wall[0]*game.cellSize,wall[3]*game.cellSize,wall[0]*game.cellSize+game.cellSize ,wall[3]*game.cellSize );
|
||||
}
|
||||
else
|
||||
{
|
||||
game.strokeWeight(4);
|
||||
game.stroke(255,255,0);
|
||||
game.line(wall[0]*game.cellSize+game.cellSize,wall[1]*game.cellSize,wall[3]*game.cellSize ,wall[3]*game.cellSize+game.cellSize);
|
||||
}
|
||||
}
|
||||
public void drawGhost(int x, int y, int r, int g, int b, boolean visible){
|
||||
game.fill(r,g,b);
|
||||
game.strokeWeight(0);
|
||||
@ -43,7 +55,7 @@ public class Render {
|
||||
}
|
||||
public void drawPacman(int x, int y, boolean open){
|
||||
game.fill(255,255,0);
|
||||
|
||||
game.strokeWeight(0);
|
||||
if(open){
|
||||
game.arc(x,y,game.cellSize*0.8f,game.cellSize*0.8f, game.radians(45),game.radians(315));
|
||||
game.fill(0);
|
||||
|
||||
BIN
game.class
BIN
game.class
Binary file not shown.
12
game.java
12
game.java
@ -25,13 +25,16 @@ public class Game extends PApplet{
|
||||
/*---------------Methoden------*/
|
||||
|
||||
public void settings() {
|
||||
size(10 * cellSize, 10 * cellSize);
|
||||
size(11 * cellSize, 11 * cellSize);
|
||||
}
|
||||
|
||||
|
||||
public void draw() {
|
||||
background(0);
|
||||
pacman.draw();
|
||||
for (int i = 0; i < wall.length; i++) {
|
||||
render.drawWall(wall[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void keyPressed() {
|
||||
@ -39,7 +42,6 @@ public class Game extends PApplet{
|
||||
}
|
||||
|
||||
public boolean wantMove(int ox, int oy, int nx, int ny) {
|
||||
System.out.println(","+ox+","+ oy+","+ nx+","+ ny);
|
||||
if (ox == nx && oy > ny) {
|
||||
int a = oy;
|
||||
oy = ny;
|
||||
@ -60,8 +62,10 @@ public class Game extends PApplet{
|
||||
|
||||
public void populateWalls(){
|
||||
wall = new int[][]{
|
||||
{0, 0, 0, 1},
|
||||
{0, 1, 1, 1},
|
||||
{0, 4, 0, 5},
|
||||
{0, 5, 0, 6},
|
||||
{10,4,10,5},
|
||||
{10,5,10,6},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user