From: Neil Date: Wed, 17 Apr 2013 12:21:45 +0000 (+0200) Subject: Use labels, to make things look better X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=75da5ffb73ae3573c16177a4808b5a78a54ccd20;p=erdslangetjie.git Use labels, to make things look better --- diff --git a/erdslangetjie/__main__.py b/erdslangetjie/__main__.py index 0141bd9..e6bc2ce 100644 --- a/erdslangetjie/__main__.py +++ b/erdslangetjie/__main__.py @@ -8,7 +8,7 @@ from kivy.uix.widget import Widget from kivy.logger import Logger, LoggerHistory from kivy.uix.relativelayout import RelativeLayout from kivy.uix.scrollview import ScrollView -from kivy.uix.button import Button +from kivy.uix.label import Label from kivy.graphics import Color, Rectangle from kivy.utils import platform @@ -173,6 +173,8 @@ class GameWindow(RelativeLayout): self.do_move(direction) def do_move(self, direction): + if not self.level_obj: + return self.nemesis.move(self.level_obj) self.draw_nemesis() self.player.move(direction, self.level_obj) @@ -181,6 +183,8 @@ class GameWindow(RelativeLayout): self.reset_timer() def timed_move(self): + if not self.level_obj: + return self.nemesis.move(self.level_obj) self.draw_nemesis() self.check_state() @@ -247,14 +251,19 @@ class Screen(Widget): Rectangle(pos=(0, 0), size=(1026, 760), texture=self.image.texture) - self.stop_button = Button( - text='Quit', size=(200, 40), + self.stop_button = Label( + text='[ref=quit][color=ff0066]Quit[/color][/ref]', + font_size=30, + markup=True, + size=(200, 40), pos=((1026 - 200) / 2 - 100, 100)) - self.stop_button.bind(on_press=self.app.stop_app) - self.start_button = Button( - text=self.START, size=(200, 40), + self.stop_button.bind(on_ref_press=self.app.stop_app) + self.start_button = Label( + text="[ref=start][color=00ff66]" + self.START + "[/color][/ref]", + font_size=30, + markup = True, size=(200, 40), pos=((1026 - 200) / 2 + 100, 100)) - self.start_button.bind(on_press=self.app.start_game) + self.start_button.bind(on_ref_press=self.app.start_game) self.add_widget(self.stop_button) self.add_widget(self.start_button) @@ -302,10 +311,10 @@ class GameApp(App): screen = IntroScreen(self) self.root.add_widget(screen) - def stop_app(self, button): + def stop_app(self, label, ref): self.stop() - def start_game(self, button): + def start_game(self, label, ref): """Start the game""" game = GameWindow(self.levels, self) game.build()