-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmisc.py
More file actions
56 lines (47 loc) · 1.14 KB
/
misc.py
File metadata and controls
56 lines (47 loc) · 1.14 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
def isOdd(n):
return n % 2 != 0
def isEven(n):
return n % 2 == 0
def waitForSeconds(seconds):
startTime = get_time()
finishTime = startTime + seconds
while( get_time() < finishTime ):
pass
return True
def getEntityMaxCount():
expandUnlocked = num_unlocked(Unlocks.Expand)
if(expandUnlocked == 0):
return 1
elif(expandUnlocked == 1):
return get_world_size()
else:
return (get_world_size() * get_world_size())
def getWorldMinMaxXXYY():
#return tuple (minx,maxx,miny,maxy)
minX = 0
maxX = get_world_size()-1
minY = 0
maxY = get_world_size()-1
return minX,maxX,minY,maxY
def getItemEntity(item):
itemDict = {
Items.Hay:Entities.Grass,
Items.Wood:Entities.Tree,
Items.Carrot:Entities.Carrot,
Items.Pumpkin:Entities.Pumpkin,
Items.Cactus:Entities.Cactus,
Items.Bone:Entities.Apple,
Items.Gold:Entities.Bush,
Items.Power:Entities.Sunflower
}
if not item in itemDict:
return None
entity = itemDict[item]
if( entity == Entities.Tree and num_unlocked(Unlocks.Trees) == 0 ):
entity = Entities.Bush
return entity
def listToSet(inputList):
returnSet = set()
for stuff in inputList:
returnSet.add(stuff)
return returnSet