Skip to content
Browse files

beginnings of an enemy

  • Loading branch information...
1 parent 87d10e7 commit 39c488b81f85bc696448903318c33a7fb54c5de5 @jrabbit committed Dec 10, 2010
Showing with 24 additions and 1 deletion.
  1. +8 −1 jellystoned.py
  2. +16 −0 splicer.py
View
9 jellystoned.py
@@ -9,6 +9,7 @@
if not pygame.mixer: print 'Warning, sound disabled'
from helpers import *
+from splicer import *
#boilerplate pygame used lovingly from http://www.learningpython.com/2006/03/12/creating-a-game-in-python-using-pygame-part-one/
class GameMain:
"""The Main AWNM Class - This class handles the main initialization and creating of the Game."""
@@ -20,6 +21,7 @@ def __init__(self, width=640,height=480):
self.width = width
self.height = height
"""Create the Screen"""
+ pygame.display.set_caption("Jelleystoned! By Jrabbit!", "jellystoned")
self.screen = pygame.display.set_mode((self.width, self.height))
def MainLoop(self):
"""This is the Main Loop of the Game"""
@@ -36,7 +38,7 @@ def MainLoop(self):
self.bear.move(event.key)
self.background = pygame.Surface(self.screen.get_size())
self.background = self.background.convert()
- self.background.fill((250, 250, 250))
+ self.background.fill((85,98,112))
self.screen.blit(self.background, (0, 0))
self.bear_sprites.draw(self.screen)
pygame.display.flip()
@@ -45,6 +47,11 @@ def load_sprites(self):
self.bear_sprites = pygame.sprite.RenderPlain((self.bear))
+class Pig(pygame.sprite.Sprite):
+ def __init__(self):
+ pygame.sprite.Sprite.__init__(self)
+ self.image, self.rect = load_image('cop_array.png',-1)
+ width, height = self.image.get_size()
class Bear(pygame.sprite.Sprite):
def __init__(self):
View
16 splicer.py
@@ -0,0 +1,16 @@
+#Source: http://shinylittlething.com/2009/07/21/pygame-and-animated-sprites/
+#Using this until it can be rewritten or removed.
+def load_sliced_sprites(w, h, filename):
+ '''
+ Specs :
+ Master can be any height.
+ Sprites frames width must be the same width
+ Master width must be len(frames)*frame.width
+ '''
+ images = []
+ master_image = pygame.image.load(os.path.join('', filename)).convert_alpha()
+
+ master_width, master_height = master_image.get_size()
+ for i in xrange(int(master_width/w)):
+ images.append(master_image.subsurface((i*w,0,w,h)))
+ return images

0 comments on commit 39c488b

Please sign in to comment.
Something went wrong with that request. Please try again.