-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTileBlock.java
166 lines (147 loc) · 4.24 KB
/
TileBlock.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
import greenfoot.*;
/**
* The TileBlock class, to allow tiles that cannot be passed through in the GameWorld.
*
* @author Matthew Hillier
* @version 1.0
*/
public class TileBlock extends Tiles
{
private int tileX; //The X coordinate of the image.
private int tileY; //The Y coordinate of the image.
/**
* Creates a new TileBlock.
* @param inName The door's name.
* @param inSheetX The image's X coordinate.
* @param inSheetY The image's Y coordinate.
* @param inType The Block's type.
* @param tileSetNum The tileSet id.
* @param inWorldX The X coordinate in the world.
* @param inWorldY The Y coordinate in the world.
*/
public TileBlock(String inName, int inSheetX, int inSheetY, String inType, int tileSetNum, int inWorldX, int inWorldY)
{
super(inName, inSheetX, inSheetY, tileSetNum, inWorldX, inWorldY);
this.type = inType;
tileX = inWorldX;
tileY = inWorldY;
}
/**
* Called when added to the world.
*
* Overrides the default addedToWorld(World world).
* @param world The world it has been added to.
*/
protected void addedToWorld(World world)
{
if(type.equals("Messenger"))
{
signAct();
}
}
/**
* Assigns a message to a sign.
*/
public void signAct()
{
switch(tileX)
{
case 9:
if(tileY == 56)
{
this.message = "TRAINER TIPS\nNo stealing other people's\nPOKéMON! POKé BALLS are to be\nthrown only at wild POKéMON!";
}
break;
case 11:
if(tileY == 16)
{
this.message = "VIOLET CITY POKEMON GYM\nLEADER: FALKNER\nThe Elegant Master of\nFlying POKEMON";
}
break;
case 15:
if(tileY == 78)
{
this.message = "ROUTE 30\nVIOLET CITY -\nCHERRYGROVE CITY";
}
break;
case 19:
if(tileY == 64)
{
this.message = "MR.POKéMON'S HOUSE:\nStraight Ahead!";
}
else if(tileY == 98)
{
this.message = "GUIDE GENT'S HOUSE";
}
break;
case 20:
if(tileY == 19)
{
this.message = "VIOLET CITY\nThe City of Nostalgic Scents";
}
break;
case 21:
if(tileY == 40)
{
this.message = "MR.POKEMON'S HOUSE";
}
break;
case 23:
if(tileY == 16)
{
this.message = "EARL'S POKEMON ACADEMY";
}
break;
case 26:
if(tileY == 97)
{
this.message = "CHERRYGROVE CITY\nThe City of Cute, Fragrant Flowers";
}
break;
case 39:
if(tileY == 94)
{
this.message = "Route 29\nCHERRYGROVE CITY -\nNEW BARK TOWN";
}
break;
case 87:
if(tileY == 96)
{
this.message = "Route 29\nCHERRYGROVE CITY -\nNEW BARK TOWN";
}
break;
case 101:
if(tileY == 92)
{
this.message = "ELM POKEMON LAB";
}
break;
case 106:
if(tileY == 97)
{
this.message = "NEW BARK TOWN\nThe Town Where the Winds of a New\nBeginning Blow";
}
break;
case 107:
if(tileY == 102)
{
this.message = "ELM'S HOUSE";
}
break;
case 109:
if(tileY == 94)
{
GameWorld gameWorld = (GameWorld) getWorld();
this.message = gameWorld.getPlayerName() + "'s House";
}
break;
}
}
/**
* Returns the name of the TileBlock.
*/
public String getName()
{
return name;
}
}