from erdslangetjie.level import LevelList
from erdslangetjie.player import ThePlayer, Nemesis
-TILE_SIZE = 48
-
+if platform() != 'android':
+ TILE_SIZE = 40
+else:
+ TILE_SIZE = 64
class GameWindow(RelativeLayout):
class GameApp(App):
+ title = "Peter's thread snake"
+
def __init__(self):
self.levels = LevelList()
super(GameApp, self).__init__()
def build(self):
- root = ScrollView(size=(960, 640), size_hint=(None, None))
- game = GameWindow(self.levels, root)
+ root = ScrollView(size_hint=(None, None))
+ return root
+
+ def on_start(self):
+ from kivy.base import EventLoop
+ window = EventLoop.window
+ if platform() == 'android':
+ window.fullscreen = True
+ self.root.size = window.size
+ game = GameWindow(self.levels, self.root)
game.build()
- root.add_widget(game)
+ self.root.add_widget(game)
# Ensure the player is visible
- root.scroll_x = 0
- root.scroll_y = 0
+ self.root.scroll_x = 0
+ self.root.scroll_y = 0
game.draw_player()
game.draw_nemesis()
- return root
def main():