- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTileBlock.java
More file actions
Latest commit
166 lines (147 loc) · 4.24 KB
/
Copy pathTileBlock.java
File metadata and controls
166 lines (147 loc) · 4.24 KB
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
importgreenfoot.*;
/**
* The TileBlock class, to allow tiles that cannot be passed through in the GameWorld.
*
* @author Matthew Hillier
* @version 1.0
*/
publicclassTileBlockextendsTiles
{
privateinttileX; //The X coordinate of the image.
privateinttileY; //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.
*/
publicTileBlock(StringinName, intinSheetX, intinSheetY, StringinType, inttileSetNum, intinWorldX, intinWorldY)
{
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.
*/
protectedvoidaddedToWorld(Worldworld)
{
if(type.equals("Messenger"))
{
signAct();
}
}
/**
* Assigns a message to a sign.
*/
publicvoidsignAct()
{
switch(tileX)
{
case9:
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;
case11:
if(tileY == 16)
{
this.message = "VIOLET CITY POKEMON GYM\nLEADER: FALKNER\nThe Elegant Master of\nFlying POKEMON";
}
break;
case15:
if(tileY == 78)
{
this.message = "ROUTE 30\nVIOLET CITY -\nCHERRYGROVE CITY";
}
break;
case19:
if(tileY == 64)
{
this.message = "MR.POKéMON'S HOUSE:\nStraight Ahead!";
}
elseif(tileY == 98)
{
this.message = "GUIDE GENT'S HOUSE";
}
break;
case20:
if(tileY == 19)
{
this.message = "VIOLET CITY\nThe City of Nostalgic Scents";
}
break;
case21:
if(tileY == 40)
{
this.message = "MR.POKEMON'S HOUSE";
}
break;
case23:
if(tileY == 16)
{
this.message = "EARL'S POKEMON ACADEMY";
}
break;
case26:
if(tileY == 97)
{
this.message = "CHERRYGROVE CITY\nThe City of Cute, Fragrant Flowers";
}
break;
case39:
if(tileY == 94)
{
this.message = "Route 29\nCHERRYGROVE CITY -\nNEW BARK TOWN";
}
break;
case87:
if(tileY == 96)
{
this.message = "Route 29\nCHERRYGROVE CITY -\nNEW BARK TOWN";
}
break;
case101:
if(tileY == 92)
{
this.message = "ELM POKEMON LAB";
}
break;
case106:
if(tileY == 97)
{
this.message = "NEW BARK TOWN\nThe Town Where the Winds of a New\nBeginning Blow";
}
break;
case107:
if(tileY == 102)
{
this.message = "ELM'S HOUSE";
}
break;
case109:
if(tileY == 94)
{
GameWorldgameWorld = (GameWorld) getWorld();
this.message = gameWorld.getPlayerName() + "'s House";
}
break;
}
}
/**
* Returns the name of the TileBlock.
*/
publicStringgetName()
{
returnname;
}
}