-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
32 lines (27 loc) · 811 Bytes
/
Copy pathPlayer.java
File metadata and controls
32 lines (27 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.util.*;
import javalib.impworld.*;
import javalib.worldimages.*;
import javalib.colors.*;
import java.awt.Color;
//represents the movable player
class Player {
//represents the player's x coordinate
int x;
//represents the player's y coordinate
int y;
//constructor
Player(int x, int y) {
this.x = x;
this.y = y;
}
//draws the image of the player
WorldImage draw() {
return new RectangleImage(
new Posn(
this.x * MazeGame.CELL_SIZE + MazeGame.CELL_SIZE / 2,
this.y * MazeGame.CELL_SIZE + MazeGame.CELL_SIZE / 2),
MazeGame.CELL_SIZE ,
MazeGame.CELL_SIZE,
new Color(255, 255, 255));
}
}