I'm busy making a Java game, and for enemies, I store them in an ArrayList
. But when I try to use the get(int)
method, it keeps giving me The type of get(int) is erroneous where E is a type-variable:
Why is this? Shouldn't it just return the element? I've searched a while and haven't been able to find a solution to this.
Here's the part of my code:
for(int i=0;i<holes.size();i++){
hole temp = holes.get(i);
if((p1.playerRec.x/48)==(temp.holeRec.x/48) && (p1.playerRec.y/48)==(temp.holeRec.y/48)){
gameOver=true;
}
}
public void findHoles(){
for(int i=0;i<map1.height;i++){
for(int j=0;j<map1.width;j++){
if(map1.tileMap[i][j]==5){
addHole(new hole(i,j));
}
}
}
}
public void addHole(hole h){
holes.add(h);
}