forked from Kyleleesang/TextGame
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoom.java
More file actions
50 lines (39 loc) · 924 Bytes
/
Room.java
File metadata and controls
50 lines (39 loc) · 924 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package homework1;
import java.lang.String;
import java.util.Arrays;
/**
*
* @author kleesans
*/
public class Room {
String name;
String description;
String state;
Creature[] RoomAnimals = new Creature[10];
Room north;
Room south;
Room west;
Room east;
public Room(String n) {
name = n;
RoomAnimals = new Creature[10];
}
public String toString() {
for (int i = 0; i < RoomAnimals.length; i++){
System.out.println(Animal.toString([i]));
}
}
public void addAnimal(Animal a) {
for (int i = 0; i < 10; i++){
if (RoomAnimals[i] == null){
RoomAnimals[i] = Animal(a);
i++;
}
}
}
}