-
Notifications
You must be signed in to change notification settings - Fork 0
/
Overworld.java
90 lines (85 loc) · 1.97 KB
/
Overworld.java
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import greenfoot.*;
/**
* The OverWorld class, to allow some common methods to all objects in the GameWorld.
*
* @author Matthew Hillier
* @version 1.0
*/
public class Overworld extends Actor
{
/**
* Returns if there is an object of a certain class at the same location or not.
* @param cls The class to check for.
*/
public boolean isObjectOn(Class cls)
{
if(getOneObjectAtOffset(0, 0, cls) == null)
{
return false;
}
else
{
return true;
}
}
/**
* Returns if there is an object of a certain class above or not.
* @param cls The class to check for.
*/
public boolean isObjectAbove(Class cls)
{
if(getOneObjectAtOffset(0, -48, cls) == null)
{
return false;
}
else
{
return true;
}
}
/**
* Returns if there is an object of a certain class below or not.
* @param cls The class to check for.
*/
public boolean isObjectBelow(Class cls)
{
if(getOneObjectAtOffset(0, 48, cls) == null)
{
return false;
}
else
{
return true;
}
}
/**
* Returns if there is an object of a certain class left or not.
* @param cls The class to check for.
*/
public boolean isObjectLeft(Class cls)
{
if(getOneObjectAtOffset(-48, 0, cls) == null)
{
return false;
}
else
{
return true;
}
}
/**
* Returns if there is an object of a certain class right or not.
* @param cls The class to check for.
*/
public boolean isObjectRight(Class cls)
{
if(getOneObjectAtOffset(47, 0, cls) == null)
{
return false;
}
else
{
return true;
}
}
}