-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
109 lines (97 loc) · 2.68 KB
/
test.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import pickle
import time
import cyclops
from map_generator import *
dungeon = Dungeon((100, 80), "Neverland", 50, (4, 4), (12, 12), (8, 8))
dungeon.generate_dungeon()
tile = dungeon.grid
print 'tile:'
#print tile
scene = getSceneManager()
cam = getDefaultCamera()
scene.setBackgroundColor(Color(0, 0, 0, 1))
sn_root = SceneNode.create('root')
## Create a point ligh
light1 = Light.create()
light1.setLightType(LightType.Point)
light1.setColor(Color(1.0, 1.0, 1.0, 1.0))
light1.setPosition(cam.getPosition())
light1.setEnabled(True)
cam.addChild(light1)
cam.setPosition(50,125,40)
cam.pitch(-3.14*0.5)
for z in xrange(80):
for x in xrange(100):
#print z,x
ti = tile[z][x]
'''
0 = blank space (non-useable)
1 = floor tile (walkable)
2 = corner tile (non-useable)
3 = wall tile facing NORTH.
4 = wall tile facing EAST.
5 = wall tile facing SOUTH.
6 = wall tile facing WEST.
7 = door tile.
8 = stairs leading to a higher lever in the dungeon.
9 = stairs leading to a lower level in the dungeon.
10 = chest
11 = path from up to down staircases (floor tile)
'''
if ti==0:
pass
elif ti==1: # floor tile
box = BoxShape.create(1,0.2,1)
box.setPosition(x,0.1,z)
box.setEffect('colored -d green')
sn_root.addChild(box)
elif ti==2: # corner
box = BoxShape.create(1,1,1)
box.setPosition(x,0.5,z)
box.setEffect('colored -d white')
sn_root.addChild(box)
elif ti==3: # NORTH wall
box = BoxShape.create(1,1,1)
box.setPosition(x,0.5,z)
box.setEffect('colored -d blue')
sn_root.addChild(box)
elif ti==4: # EAST wall
box = BoxShape.create(1,1,1)
box.setPosition(x,0.5,z)
box.setEffect('colored -d blue')
sn_root.addChild(box)
elif ti==5: # SOUTH wall
box = BoxShape.create(1,1,1)
box.setPosition(x,0.5,z)
box.setEffect('colored -d blue')
sn_root.addChild(box)
elif ti==6: # WEST wall
box = BoxShape.create(1,1,1)
box.setPosition(x,0.5,z)
box.setEffect('colored -d blue')
sn_root.addChild(box)
elif ti==7: # door
box = BoxShape.create(1,0.2,1)
box.setPosition(x,0.1,z)
box.setEffect('colored -d #00611c')
sn_root.addChild(box)
elif ti==8: # upstairs
box = BoxShape.create(1,1,1)
box.setPosition(x,0.5,z)
box.setEffect('colored -d white')
sn_root.addChild(box)
elif ti==9: # downstairs
box = BoxShape.create(1,1,1)
box.setPosition(x,0.5,z)
box.setEffect('colored -d black')
sn_root.addChild(box)
elif ti==10: # chest
box = BoxShape.create(1,1,1)
box.setPosition(x,0.5,z)
box.setEffect('colored -d yellow')
sn_root.addChild(box)
elif ti==11: # path
box = BoxShape.create(1,0.2,1)
box.setPosition(x,0.5,z)
box.setEffect('colored -d green')
sn_root.addChild(box)