-
Notifications
You must be signed in to change notification settings - Fork 0
/
MapBasicBlock.java
66 lines (54 loc) · 1.5 KB
/
MapBasicBlock.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
/*
* This class is the basic bloack for all the elemnts of map we use this class in
* order to keep all the different type of the objetc in the array of map in the Map class.
* So every object that we have to put on the map must extend this class.
*/
package bomborman;
/*
* importing the the enumeration "BlockType" from the class Types
* that is defined in the packege bomborman
*/
import bomborman.Types.BlockType;
import java.awt.Image;
public class MapBasicBlock {
private BlockType blockType;
protected Position position;
protected Image image;
public MapBasicBlock( BlockType _blockType, Position _position, Image _image){
blockType = _blockType;
position = _position;
image = _image;
}
public MapBasicBlock( BlockType _blockType, Position _position){
blockType = _blockType;
position = _position;
}
/*
* This function return the type of the Block on the map.
*/
public BlockType getBlockType(){
return blockType;
}
public Position getPosition(){
return position;
}
public void setPosition(Position newPosition){
position = newPosition;
}
public boolean isofType( BlockType _blockType ){
if( blockType == _blockType ){
return true;
}else{
return false;
}
}
public Image getImage(){
return image;
}
public void explode(){
if(blockType != BlockType.UNBREKABLE){
Map m = Map.getInstance(1, 1);
m.map[position.getRow()][position.getColumn()] =null;
}
}
}