Merge branch 'master' of hongabar.org:robotgame

This commit is contained in:
Sakse Dalum 2012-08-09 12:43:50 +02:00
commit 1ebd4a9c91
2 changed files with 11 additions and 10 deletions

View File

@ -34,12 +34,17 @@ class Block(worldobject.WorldObject):
worldobject.WorldObject.__init__(self, level, x, y, movable=movable) worldobject.WorldObject.__init__(self, level, x, y, movable=movable)
self.orig_alpha = pygame.surfarray.array_alpha(self.img) self.orig_alpha = pygame.surfarray.array_alpha(self.img)
self.is_currently_opaque = True
def update_alpha(self): def update_alpha(self):
if (self.y + self.z >= self.level.player.y + self.level.player.z): be_opaque = not (self.y + self.z >= self.level.player.y
self.set_alpha(0.5) + self.level.player.z)
else: if be_opaque and not self.is_currently_opaque:
self.is_currently_opaque = True
self.set_alpha(1) self.set_alpha(1)
elif not be_opaque and self.is_currently_opaque:
self.is_currently_opaque = False
self.set_alpha(0.5)
def use(self, obj): def use(self, obj):
if self.movable: if self.movable:
@ -60,6 +65,7 @@ class ArrowBlock(Block):
self.__dict__.update(locals()) self.__dict__.update(locals())
worldobject.WorldObject.__init__(self, level, x, y, worldobject.WorldObject.__init__(self, level, x, y,
direction=direction, movable=movable) direction=direction, movable=movable)
self.is_currently_opaque = True
self.frame = 0 self.frame = 0
self.anim_speed = 15 self.anim_speed = 15
@ -109,6 +115,7 @@ class RisingBlock(Block):
def __init__(self, level, x, y, movable=False, is_up=True): def __init__(self, level, x, y, movable=False, is_up=True):
self.__dict__.update(locals()) self.__dict__.update(locals())
worldobject.WorldObject.__init__(self, level, x, y, movable=movable) worldobject.WorldObject.__init__(self, level, x, y, movable=movable)
self.is_currently_opaque = True
self.frame = 0 self.frame = 0
self.anim_speed = 15 self.anim_speed = 15

View File

@ -136,9 +136,3 @@ class Level3(level.Level):
def restart(self): def restart(self):
for obj in self.objects: for obj in self.objects:
obj.reset_pos() obj.reset_pos()
def infrange():
n = 0
while True:
yield n
n += 1