diff --git a/.gitignore b/.gitignore
index d0b85ca..85f9244 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
*~
-*.py[co]
\ No newline at end of file
+*.py[co]
+/.old
\ No newline at end of file
diff --git a/robotgame/game.py b/robotgame/game.py
index 9ed5add..31ad34b 100644
--- a/robotgame/game.py
+++ b/robotgame/game.py
@@ -69,7 +69,7 @@ class Game(object):
self.objs.append(main_menu.MainMenu(self, graphics_dir))
else:
exec 'from level%d import Level%d as level' % (self.initial_goto_level,
- self.initial_goto_level)
+ self.initial_goto_level)
self.goto_level(level(self, graphics_dir))
def run(self):
diff --git a/robotgame/level2.py b/robotgame/level2.py
index 9850387..2f05944 100644
--- a/robotgame/level2.py
+++ b/robotgame/level2.py
@@ -10,9 +10,11 @@ import block
import boulder
import lever
+
class Level2(level.Level):
def __init__(self, game, graphics_dir, paused=False):
- level.Level.__init__(self, game, graphics_dir, paused)
+ level.Level.__init__(self, game, graphics_dir, size=(64*20, 48*20),
+ paused=paused)
self.dimensions = 20, 20
@@ -21,6 +23,8 @@ class Level2(level.Level):
self.tiles.append(
tile.Tile(self, i*64, j*48, self.imgs['ground1']))
+ self.draw_background()
+
blocks = [block.Block(self, 64*4, 48, self.imgs['block1'])]
self.objects.extend(blocks)
diff --git a/robotgame/level3.py b/robotgame/level3.py
new file mode 100644
index 0000000..86e4511
--- /dev/null
+++ b/robotgame/level3.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# This file is part of ROBOTGAME
+#
+# ROBOTGAME is free software: you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+#
+# ROBOTGAME is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# ROBOTGAME. If not, see .
+#
+# ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
+#
+# level3.py
+# --------------------
+# date created : Wed Aug 8 2012
+# copyright : (C) 2012 Niels G. W. Serup
+# maintained by : Niels G. W. Serup
+
+"""
+The third level.
+"""
+
+import os
+import pygame
+import random
+import re
+
+import level
+import player
+import tile
+import block
+import boulder
+import lever
+
+
+import logic.colourboxes
+
+class Level3(level.Level):
+ def __init__(self, game, graphics_dir, paused=False):
+ level.Level.__init__(self, game, graphics_dir, size=(64*20, 48*20),
+ paused=paused)
+
+ self.dimensions = 20, 20
+
+ for i in range(self.dimensions[0]):
+ for j in range(self.dimensions[1]):
+ self.tiles.append(
+ tile.Tile(self, i*64, j*48, self.imgs['ground1']))
+
+ self.draw_background()
+
+
+ def load(self):
+ """Load all resources used in the level."""
+ tile_list = ['ground1', 'ground2']
+
+ for tile in tile_list:
+ self.imgs[tile] = pygame.image.load(os.path.join(
+ self.graphics_dir, 'tiles', '%s.png' % tile))
+
+ block_list = ['block1']
+ for block in block_list:
+ self.imgs[block] = pygame.image.load(os.path.join(
+ self.graphics_dir, 'blocks', '%s.png' % block))
+
+ def restart(self):
+ for obj in self.objects:
+ obj.reset_pos()