-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgeneratePath.py
More file actions
28 lines (24 loc) · 767 Bytes
/
Copy pathgeneratePath.py
File metadata and controls
28 lines (24 loc) · 767 Bytes
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
# Generate path for npc
def f(_type, direction, time=0):
if _type == "walk":
print("{type:\"" + _type + "\",direction:\"" + direction + "\"},")
else: # "stand"
print("{type:\"" + _type + "\",direction:\"" + direction + "\",time:" + str(time) + "},")
def p(direction_string):
i = 0
while i < len(direction_string):
dir = direction_string[i]
if dir == "l":
f("walk", "left")
elif dir == "r":
f("walk", "right")
elif dir == "u":
f("walk", "up")
elif dir == "d":
f("walk", "down")
elif dir == "s": # stand
i += 1
D = direction_string[i]
f("stand", D, 500)
i += 1
p("rurrdrrrrrsrdllllldllsuulu")