diff options
Diffstat (limited to 'horse.py')
-rwxr-xr-x | horse.py | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -56,10 +56,17 @@ class Game(): self.horse_speed = 8 # pixels per tick; at 25 ticks/second, this is approx 200 pixels per second self.horse_reach = 20 # pixels from cener of horse where he can reach self.target_loc = None - self.cursor = pygame.cursors.compile(cursor.cursor_data) def setup(self): - self.screen_size = self.screen.get_size() # tuple + pygame.display.init() + self.cursor = pygame.cursors.compile(cursor.cursor_data) + self.screen = pygame.display.get_surface() + if not(self.screen): + info = pygame.display.Info() + x = info.current_w + y = info.current_h - 75 + self.screen = pygame.display.set_mode((x, y)) + self.screen_size = self.screen.get_size() # load the images and convert to screen format self.grass_image = pygame.image.load('images/grass.png','grass') self.grass_image.convert(self.screen) @@ -196,11 +203,9 @@ class Game(): self.moving_left = False def run(self): - pygame.mouse.set_cursor((32,32), (1,1), *self.cursor) - self.screen = pygame.display.get_surface() - clock = pygame.time.Clock() self.setup() - + clock = pygame.time.Clock() + pygame.mouse.set_cursor((32,32), (1,1), *self.cursor) while self.game_running: #GTK events while gtk.events_pending(): @@ -215,4 +220,7 @@ class Game(): for event in events: self.handleEvent(event) +if __name__ == "__main__": + g = Game() + g.run() |