diff --git a/resources/graphics/intro-screen.png b/resources/graphics/intro-screen.png new file mode 100644 index 0000000..4dd036d Binary files /dev/null and b/resources/graphics/intro-screen.png differ diff --git a/resources/graphics/intro-screen.xcf b/resources/graphics/intro-screen.xcf new file mode 100644 index 0000000..4c3b013 Binary files /dev/null and b/resources/graphics/intro-screen.xcf differ diff --git a/robotgame/game.py b/robotgame/game.py index 60b4f63..ddd4f30 100644 --- a/robotgame/game.py +++ b/robotgame/game.py @@ -58,7 +58,7 @@ class Game(object): def load(self): graphics_dir = os.path.join(self.directory, "resources", "graphics") - self.loader = loader.Loader(graphics_dir) + self.loader = loader.Loader(self, graphics_dir) self.loader.load() self.level = None diff --git a/robotgame/level.py b/robotgame/level.py index 5b65fe6..2bed7b4 100644 --- a/robotgame/level.py +++ b/robotgame/level.py @@ -49,6 +49,11 @@ class Level(object): self.darkness = fadeout.Darkness(self.game, 0) + self.load() + + def load(self): + pass + def set_darkness(self, darkness): self.darkness.set_darkness(darkness) diff --git a/robotgame/level0.py b/robotgame/level0.py new file mode 100644 index 0000000..380199d --- /dev/null +++ b/robotgame/level0.py @@ -0,0 +1,40 @@ +# 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 . +# +# ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' +# +# level0.py +# -------------------- +# date created : Tue Aug 7 2012 +# copyright : (C) 2012 Sakse Dalum +# maintained by : Sakse Dalum + +""" +The zeroth level. +""" + +import pygame + +import level + +class Level0(level.Level): + def update(self, e, t, dt): + if not self.paused: + for event in e: + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_SPACE: + self.game.goto_level(1) + + def draw(self, window): + window.blit(self.imgs['intro-screen'], (0, 0)) diff --git a/robotgame/loader.py b/robotgame/loader.py index c7c1dba..4028f73 100644 --- a/robotgame/loader.py +++ b/robotgame/loader.py @@ -29,7 +29,7 @@ import os import re class Loader(object): - def __init__(self, directory): + def __init__(self, game, directory): self.__dict__.update(locals()) self.imgs = {} @@ -56,11 +56,25 @@ class Loader(object): self.imgs[o] = pygame.image.load(os.path.join( self.directory, 'blocks', '%s.png' % o)) - l = ['hole', 'well', 'wall', 'wall_outside'] + l = ['hole', 'well', 'wall', 'wall_outside', 'intro-screen'] for o in l: self.imgs[o] = pygame.image.load(os.path.join( self.directory, '%s.png' % o)) + + # Special treatment + screen_size = self.game.window.get_size() + img_size = self.imgs['intro-screen'].get_size() + factors = (float(img_size[0]) / 1920, float(img_size[1]) / 1440) + + self.imgs['intro-screen'] = pygame.transform.smoothscale( + self.imgs['intro-screen'], + (int(screen_size[0]*factors[0]), + int(screen_size[1]*factors[1]))) + + ### Moat + + l = ['moat_corner_north', 'moat_corner_south', 'moat_corner_north_flip', diff --git a/robotgame/main_menu.py b/robotgame/main_menu.py index e2f33eb..fb9dda6 100644 --- a/robotgame/main_menu.py +++ b/robotgame/main_menu.py @@ -59,7 +59,7 @@ class MainMenu(object): for event in e: if event.type == pygame.KEYDOWN: if event.key == pygame.K_SPACE: - self.game.goto_level(1) + self.game.goto_level(0) if event.key == pygame.K_ESCAPE: self.game.stop()