-
Notifications
You must be signed in to change notification settings - Fork 0
/
resource.py
57 lines (43 loc) · 1.28 KB
/
resource.py
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
from block import Block
class Terrain(Block):
def __init__(self):
super().__init__()
self.name = "Generic terrain"
self.drop = "<undefined>"
self.harvest_sound = "<undefined>"
def setPosition(self, pos):
self.rect.topleft = pos
def __repr__(self):
return self.name
class Grass(Terrain):
def __init__(self, pos):
super().__init__()
self.image = './images/grass.png'
self.pos = pos
self.setImage(self.image)
self.setSize()
self.setPosition(self.pos)
class Tree(Terrain):
scarcity_percentage = 10
def __init__(self, pos):
super().__init__()
self.name = "Tree"
self.drop = "Wood"
self.image = './images/tree.png'
self.harvest_sound = './sounds/wood_chop.ogg'
self.pos = pos
self.setImage(self.image)
self.setSize()
self.setPosition(self.pos)
class Ore(Terrain):
scarcity_percentage = 2
def __init__(self, pos):
super().__init__()
self.name = "Ore"
self.drop = "Metal"
self.image = './images/ore.png'
self.harvest_sound = './sounds/ore_mine.ogg'
self.pos = pos
self.setImage(self.image)
self.setSize()
self.setPosition(self.pos)