diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-10-31 01:08:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-10-31 12:19:12 +0300 |
commit | 746192af34a65504cb86a4eca068a8f0fbb361f5 (patch) | |
tree | 12d399627720f7fc72e66deb64bac7ef0d9eb71e /hercules/code/tileutils.py | |
parent | 63f135d8af2a81a78626d6229d077e3f91a35288 (diff) | |
download | evol-tools-746192af34a65504cb86a4eca068a8f0fbb361f5.tar.gz evol-tools-746192af34a65504cb86a4eca068a8f0fbb361f5.tar.bz2 evol-tools-746192af34a65504cb86a4eca068a8f0fbb361f5.tar.xz evol-tools-746192af34a65504cb86a4eca068a8f0fbb361f5.zip |
hercules: split implimentation to many files.
Diffstat (limited to 'hercules/code/tileutils.py')
-rw-r--r-- | hercules/code/tileutils.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/hercules/code/tileutils.py b/hercules/code/tileutils.py new file mode 100644 index 0000000..c5457e7 --- /dev/null +++ b/hercules/code/tileutils.py @@ -0,0 +1,48 @@ +# -*- coding: utf8 -*- +# +# Copyright (C) 2014 Evol Online +# Author: Andrei Karas (4144) + +import array + +def getTileData(mapData, x, y, sx): + data = mapData[y * sx + x] + arr = array.array("B") + arr.fromstring(data) + data = arr[0] + return data + +def getTile(data): + normal = 0 + collison = 0 + if data == 0: # 000 normal walkable + normal = 1 + collision = 5 + elif data == 1: # 001 non walkable + normal = 2 + collision = 6 + elif data == 2: # 010 same with 0 + normal = 1 + collision = 5 + elif data == 3: # 011 same with 0, but water + normal = 3 + collision = 5 + elif data == 4: # 100 same with 0 + normal = 1 + collision = 5 + elif data == 5: # 101 same with 1, but shootable (for now not supported!!!) + normal = 4 + collision = 6 + elif data == 6: # 110 same with 0 + normal = 1 + collision = 5 + return (str(normal), str(collision)) + +def getGroundTile(flag): + return str(flag + 1) + +def getCollisionTile(flag): + if flag == 0: + return "0" + return "4" + |