Hello,
I am not quite sure what other Room object should call the mentioned methods in main, apart from the game object.
I'd be really grateful if someone could point out what's wrong in my code.
Thanks a bunch.
Branka
package com.codegym.task.task23.task2312;
public class Room {
private int width;
private int height;
private static Snake snake;
private static Mouse mouse;
public int getWidth(){
return width;
}
public int getHeight(){
return height;
}
public Snake getSnake(){
return snake;
}
public Mouse getMouse(){
return mouse;
}
public void setWidth(int width){
this.width = width;
}
public void setHeight(int height){
this.height = height;
}
public void setSnake(Snake snake){
this.snake = snake;
}
public void setMouse(Mouse mouse){
this.mouse = mouse;
}
public Room(int width, int height, Snake snake)
{
this.width = width;
this.height = height;
this.snake = snake;
}
public static Room game;
public void run(){
}
public void print(){
}
public void sleep(){
}
public void createMouse(){
int x = (int) (Math.random() * getWidth());
int y = (int) (Math.random() * getHeight());
setMouse(new Mouse(x, y));
}
public void eatMouse(){
createMouse();
}
public static void main(String[] args){
Snake snake1 = new Snake(4, 5);
game = new Room(5, 5, snake1);
snake1.setDirection(SnakeDirection.DOWN);
game.createMouse();
game.run();
}
}