first question, sorry if it's a bad one i'm new to OOP. I have two instances that i'm using in the method, one passed as an argument called in another class where the instance is made, and one that gets created in the method. I then try calling a method from a seperet class that makes use of those instances, but get the error saying it cant be referenced from a static location?
any help much appreciated
public void displayRoom(character c){
if(ItemsInRoom.size() > 0){
for(int i = 0; i < ItemsInRoom.size(); i++){
System.out.println(ItemsInRoom.get(i).getName());
}
}
if(enemies.size() > 0){
for(int i = 0; i < enemies.size(); i++){
System.out.println(enemies.get(i).getName());
Random rand = new Random();
int rand_3 = rand.nextInt(10);
if(rand_3 > 5){
character temp = enemies.get(0);
character.attack(c, temp);//ERROR IS HERE
the method I'm trying to call that's in another class:
public void attack(character c, character e){
System.out.println(e.getName() + "has attacked you!");
c.setHealth(-3);
System.out.println("Health: " + c.getHealth());