File: util.py

package info (click to toggle)
snowballz 0.9.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 10,888 kB
  • ctags: 1,242
  • sloc: python: 7,511; makefile: 53; sh: 2
file content (29 lines) | stat: -rw-r--r-- 748 bytes parent folder | download | duplicates (4)
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
import os
animations = {}

def gen_walk_animations():
    # Must be called before units are created!
num_frames = 10
directions = [(0,1), (-1,1), (-1,0), (-1,-1), (0,-1), (1,-1), (1,0), (1,1)]
for d in directions:
    if d == (0,1):
        frame_add = 0
    if d == (-1,1):
        frame_add = 20
    if d == (-1,0):
        frame_add = 40
    if d == (-1,-1):
        frame_add = 60
    if d == (0,-1):
        frame_add = 80
    if d == (1,-1):
        frame_add = 100
    if d == (1,0):
        frame_add = 120
    if d == (1,1):
        frame_add = 150
    name = "walk%i%i" % d
    for i in range(num_frames):
        file = "%04d.png" % (i+1+frame_add)
        fullpath = os.path.join("data", "units", "penguin", file)
        print fullpath