Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/block.py
diff options
context:
space:
mode:
authorWalter Bender <walter@walter-laptop.(none)>2010-01-20 14:14:27 (GMT)
committer Walter Bender <walter@walter-laptop.(none)>2010-01-20 14:14:27 (GMT)
commita30ed7c96cee279ac0449d5bf816d7f23dcf3d94 (patch)
tree5828ec250f45427ba54ac3c9fb3d02d456c5ba8a /block.py
parent9d575d1de1bfae8212a936aaf64556dd98a9ee80 (diff)
broken sprites, but closer to working?
Diffstat (limited to 'block.py')
-rw-r--r--block.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/block.py b/block.py
index 45412b8..5a7cb3d 100644
--- a/block.py
+++ b/block.py
@@ -62,11 +62,11 @@ class Blocks:
# A class for the individual blocks
#
class Block:
- def __init__(self, blocks, prototype_style, labels=[],
+ def __init__(self, blocks, proto_name, x, y, labels=[],
colors=["#00A000","#00FF00"], scale=1.0):
self.blocks = blocks
self.spr = None
- self._new_block_from_prototype(prototype_style, labels, colors, scale)
+ self._new_block_from_prototype(proto_name, labels, colors, scale, x, y)
self.blocks.append_to_list(self)
#
# TODO:
@@ -78,10 +78,11 @@ class Block:
# debug code
# etc.
- def _new_block_from_prototype(self, proto_name, labels, colors, scale):
+ def _new_block_from_prototype(self, name, labels, colors, scale, x, y):
+ print "%s %s (%d %d)" % (name, labels[0], x, y)
basic_style = ['forward', 'back', 'left', 'right']
box_style = ['number']
- if proto_name in basic_style:
+ if name in basic_style:
svg = block_factory.SVG()
svg.set_scale(scale)
svg.expand(20,0)
@@ -91,15 +92,19 @@ class Block:
svg.set_slot(True)
svg.set_gradiant(True)
svg.set_colors(colors)
- self.spr = sprites.Sprite(self.blocks.sprites, 0, 0,
+ print "creating new basic block"
+ self.spr = sprites.Sprite(self.blocks.sprites, x, y,
svg_str_to_pixbuf(svg.basic_block()))
- elif proto_name in number_style:
+ self.spr.set_layer(2000)
+ self.spr.draw()
+ self.spr.set_label(labels[0])
+ elif name in box_style:
svg = block_factory.SVG()
svg.set_scale(scale)
svg.expand(20,0)
svg.set_gradiant(True)
svg.set_colors(colors)
- self.spr = sprites.Sprite(self.blocks.sprites, 0, 0,
+ self.spr = sprites.Sprite(self.blocks.sprites, x, y,
svg_str_to_pixbuf(svg.basic_box()))
for l in labels: