Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcoolestdude1 <arielzamparini@gmail.com>2010-02-24 20:25:22 (GMT)
committer coolestdude1 <arielzamparini@gmail.com>2010-02-24 20:25:22 (GMT)
commit8b24b119282531bbdf651b5e747dbc9ad052291b (patch)
tree4a627b3c823de0a2a11db32f600e55f535a30f50
parent3bc2155085bf183977e10ce37eb5debc24e005b3 (diff)
added in a grid and a second block with m/ handling
-rw-r--r--blocku.py14
-rw-r--r--data/Thumbs.dbbin8704 -> 11776 bytes
-rw-r--r--data/grid.pngbin0 -> 617 bytes
3 files changed, 9 insertions, 5 deletions
diff --git a/blocku.py b/blocku.py
index 2152057..b5fb014 100644
--- a/blocku.py
+++ b/blocku.py
@@ -57,10 +57,10 @@ class Block(pygame.sprite.Sprite):
east=''
south=''
west=''
- def __init__(self, n='', e='', s='', w=''):
+ def __init__(self, n='', e='', s='', w='', x='', y=''):
pygame.sprite.Sprite.__init__(self, self.containers)
self.image = self.images[0].copy()
- self.rect = pygame.Rect(200,200,64,64)
+ self.rect = pygame.Rect(x,y,64,64)
self.font = pygame.font.Font(None, 20)
self.font.set_italic(1)
self.color = Color('blue')
@@ -187,7 +187,8 @@ class Game:
#main blocku code structs
blocks = pygame.sprite.Group()
Block.containers = blocks,spriteBatch
- aBlock = Block(1,2,3,4)
+ aBlock = Block(1,2,3,4,200,200)
+ bBlock = Block(5,6,7,8,300,300)
global debugText
debugText = ''
@@ -201,7 +202,7 @@ class Game:
keyDown = False
# it is important to note that like xna the origin is 0,0
# the top left of the current window
- # print is trace in console
+ # print is trace in console
# and increases as you go down and to the right
# pygame has a collision detector under pygame.sprite.spritecollide(group,group,dokill)
# this will return a list of colliders, dokill will remove the colliders from the parrent group if true
@@ -252,7 +253,10 @@ class Game:
debugText = 'holding mouse button 1'
if aBlock.rect.collidepoint(x,y):
aBlock.grab(mouse.get_pos())
- debugText += 'grabed the block'
+ debugText += 'grabed aBlock'
+ elif bBlock.rect.collidepoint(x,y):
+ bBlock.grab(mouse.get_pos())
+ debugText += 'grabed bBlock'
else:
debugText = ''
# note random here is random.random()
diff --git a/data/Thumbs.db b/data/Thumbs.db
index 90215a3..5a1ee92 100644
--- a/data/Thumbs.db
+++ b/data/Thumbs.db
Binary files differ
diff --git a/data/grid.png b/data/grid.png
new file mode 100644
index 0000000..563c13f
--- /dev/null
+++ b/data/grid.png
Binary files differ