-
Notifications
You must be signed in to change notification settings - Fork 0
/
level1.py
86 lines (72 loc) · 5.27 KB
/
level1.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
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
#! /usr/bin/env python
#import levelBase
from helpers import *
import random
class level():
def __init__(self):
self.BLANK = 9
self.PLAYER = 1
self.QUEEN = 2
self.DONKEY = 3
self.FIREBALL = 4
self.BLOCK = 5
self.LADDER = 6
self.LADDER2 = 8
self.COIN = 7
self.START = 10
self.FLYING_BLOCK = 11
def getLayout(self):
X = [[9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9],\
[9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9],\
[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],\
[5,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,5],\
[5,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,6,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,5],\
[5,9,3,9,9,9,9,9,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,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,6,8,9,9,9,9,9,9,9,6,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,5],\
[5,9,9,9,9,9,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,9,9,9,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,8,11,11,11,9,9,9,9,9,9,9,9,5],\
[5,9,9,9,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,6,8,9,9,9,9,9,9,9,9,9,9,9,5],\
[5,9,10,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,6,8,9,9,9,9,9,9,9,9,9,9,9,5],\
[5,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,6,8,9,9,9,9,9,9,5,9,5,9,9,5],\
[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5]];
# 0-58 && 0-27
A = random.randint(20,30);
B = random.randint(0,57);
C = random.randint(3,26);
for i in range(A):
while (X[C][B] != 9):
B = random.randint(0,58);
C = random.randint(3,27);
while (X[C][B]==9):
C += 1;
while (X[C][B-1] == self.COIN or X[C][B+1] == self.COIN):
B += 1;
X[C-1][B] = self.COIN;
return X;
def getSprites(self):
block, rect = load_image('block.png',-1);
coin, rect = load_image('coin.png',-1);
player, rect = load_image('player.png',-1);
ladder, rect = load_image('ladder.png');
ladder2, rect = load_image('ladder2.png',-1);
fireball, rect = load_image('fireball.png',-1);
donkey, rect = load_image('donkey.png',-1);
queen, rect = load_image('queen.png');
blank, rect = load_image('blank.png',-1);
start, rect = load_image('start.png',-1);
return [blank, player,queen,donkey,fireball,block,ladder,coin,ladder2, blank, start]