summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Wilken2016-01-20 20:51:52 +0000
committerTimo Wilken2016-01-20 20:51:52 +0000
commit48a48ff4d381600ad51eb468466df522a7af8a55 (patch)
treec64e51f0194464d2f4edb62ed73bedf25e666e62
Initial commit with some artwork and almost no game logic.HEADmaster
-rwxr-xr-xmain.py87
-rw-r--r--resources/colors8
-rw-r--r--resources/grass.pngbin0 -> 200 bytes
-rw-r--r--resources/road2.pngbin0 -> 244 bytes
-rw-r--r--resources/road4.pngbin0 -> 258 bytes
-rw-r--r--resources/road6.pngbin0 -> 253 bytes
-rw-r--r--resources/water.pngbin0 -> 200 bytes
7 files changed, 95 insertions, 0 deletions
diff --git a/main.py b/main.py
new file mode 100755
index 0000000..92ef6ce
--- /dev/null
+++ b/main.py
@@ -0,0 +1,87 @@
+#! python
+
+"""MinCity
+
+
+
+(C) 2015 Timo Wilken
+"""
+
+from enum import Enum, unique
+from array import array
+
+import pygame
+from pygame.locals import *
+
+
+@unique
+class Tile(Enum):
+ def __init__(self, value=None):
+ self._value_ = len(self.__class__.__members__) + 1
+ self.image_name = self._name_
+
+ water = ()
+ grass = ()
+ road2 = ()
+ road4 = ()
+ road6 = ()
+
+
+class CityMap:
+ """What's where in the city.
+
+ The following map:
+
+ 0123
+ 4567
+ 89AB
+
+ is stored internally as an array with the following contents:
+ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B]
+ """
+
+ def __init__(self, width, height):
+ self._width = width
+ self._height = height
+ self._tiles = array('L')
+
+ def get_tile(self, x, y):
+ return Tile(self._tiles[x + y*self._width])
+
+ def __len__(self):
+ return self._width, self._height
+
+ def __getitem__(self, key):
+ try:
+ x, y = key
+ return self.get_tile(x, y)
+ except TypeError:
+ return Tile(self._tiles[key])
+
+
+def load_images():
+ pass
+
+
+def main():
+ pygame.init()
+ surface = pygame.display.set_mode((640, 480))
+
+ images = load_images()
+ map = CityMap(16, 16)
+
+ run = True
+ while run:
+ for e in pygame.event.get():
+ if e.type == QUIT:
+ run = False
+ break
+ surface.fill((0xFF, 0xFF, 0xFF))
+ pygame.display.update()
+
+ pygame.quit()
+
+
+if __name__ == '__main__':
+ main()
+
diff --git a/resources/colors b/resources/colors
new file mode 100644
index 0000000..1e8f0bf
--- /dev/null
+++ b/resources/colors
@@ -0,0 +1,8 @@
+asphalt 282b2a
+road markings:
+ white dddddd
+ yellow e5d663
+concrete
+grass 4dbd33
+water 0b57a4
+
diff --git a/resources/grass.png b/resources/grass.png
new file mode 100644
index 0000000..628f8dc
--- /dev/null
+++ b/resources/grass.png
Binary files differ
diff --git a/resources/road2.png b/resources/road2.png
new file mode 100644
index 0000000..8177894
--- /dev/null
+++ b/resources/road2.png
Binary files differ
diff --git a/resources/road4.png b/resources/road4.png
new file mode 100644
index 0000000..892f014
--- /dev/null
+++ b/resources/road4.png
Binary files differ
diff --git a/resources/road6.png b/resources/road6.png
new file mode 100644
index 0000000..59c40dd
--- /dev/null
+++ b/resources/road6.png
Binary files differ
diff --git a/resources/water.png b/resources/water.png
new file mode 100644
index 0000000..50dc239
--- /dev/null
+++ b/resources/water.png
Binary files differ