diff options
author | Alan Aguiar <alanjas@hotmail.com> | 2013-05-19 10:59:27 (GMT) |
---|---|---|
committer | Alan Aguiar <alanjas@hotmail.com> | 2013-05-19 10:59:27 (GMT) |
commit | 9c97585d8ed57b4518738c7494f203a1143fe55b (patch) | |
tree | 81baf7263069f1597c71515a2de01d6ec5d37e1f | |
parent | 2b3b81d0f904e8146e5f4d4f58a6fd082610a673 (diff) |
add sugar cursor
-rw-r--r-- | cursor.py | 35 | ||||
-rwxr-xr-x | horse.py | 6 |
2 files changed, 39 insertions, 2 deletions
diff --git a/cursor.py b/cursor.py new file mode 100644 index 0000000..7505ed4 --- /dev/null +++ b/cursor.py @@ -0,0 +1,35 @@ +# cursor +cursor_data = ( + "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", + "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", + "XXX.........................XXXX", + "XXX..........................XXX", + "XXX..........................XXX", + "XXX.........................XXXX", + "XXX.......XXXXXXXXXXXXXXXXXXXXX ", + "XXX........XXXXXXXXXXXXXXXXXXX ", + "XXX.........XXX ", + "XXX..........XXX ", + "XXX...........XXX ", + "XXX....X.......XXX ", + "XXX....XX.......XXX ", + "XXX....XXX.......XXX ", + "XXX....XXXX.......XXX ", + "XXX....XXXXX.......XXX ", + "XXX....XXXXXX.......XXX ", + "XXX....XXX XXX.......XXX ", + "XXX....XXX XXX.......XXX ", + "XXX....XXX XXX.......XXX ", + "XXX....XXX XXX.......XXX ", + "XXX....XXX XXX.......XXX ", + "XXX....XXX XXX.......XXX ", + "XXX....XXX XXX.......XXX ", + "XXX....XXX XXX.......XXX ", + "XXX....XXX XXX.......XXX", + "XXX....XXX XXX......XXX", + "XXX....XXX XXX.....XXX", + "XXX....XXX XXX...XXXX", + " XXX..XXX XXXXXXXX ", + " XXXXXX XXXXXX ", + " XXXX XXXX ") + @@ -26,7 +26,7 @@ import pygame import logging import math import random - +import cursor class Game(): @@ -56,7 +56,8 @@ 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 # load the images and convert to screen format @@ -195,6 +196,7 @@ 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() |