Select Git revision
change-passward.js
Wall.java 786 B
import bagel.Image;
import java.util.ArrayList;
/**
* Wall Code for SWEN20003 Project 1, Semester 2, 2022
* <p>
* Manage walls info.
* Draw walls.
* Determine the overlap between player and wall.
*
* @JIAXI3
*/
public class Wall {
private final Image Img = new Image("res/wall.png");
private final ArrayList Pos = new ArrayList();
public void Wall() {
}
public void Update() {
/*Gets all the wall locations of the ArrayList for drawing*/
for (int i = 0; i < Pos.size(); i++) {
bagel.util.Point p = (bagel.util.Point) Pos.get(i);
Img.drawFromTopLeft(p.x, p.y);
}
}
public void Add(int x, int y) {
/*Add the wall position to arraylist*/
Pos.add(new bagel.util.Point(x, y));
}
}