Merge branch 'master' of hongabar.org:robotgame
This commit is contained in:
commit
1ebd4a9c91
|
@ -34,12 +34,17 @@ class Block(worldobject.WorldObject):
|
|||
worldobject.WorldObject.__init__(self, level, x, y, movable=movable)
|
||||
|
||||
self.orig_alpha = pygame.surfarray.array_alpha(self.img)
|
||||
self.is_currently_opaque = True
|
||||
|
||||
def update_alpha(self):
|
||||
if (self.y + self.z >= self.level.player.y + self.level.player.z):
|
||||
self.set_alpha(0.5)
|
||||
else:
|
||||
be_opaque = not (self.y + self.z >= self.level.player.y
|
||||
+ self.level.player.z)
|
||||
if be_opaque and not self.is_currently_opaque:
|
||||
self.is_currently_opaque = True
|
||||
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):
|
||||
if self.movable:
|
||||
|
@ -60,6 +65,7 @@ class ArrowBlock(Block):
|
|||
self.__dict__.update(locals())
|
||||
worldobject.WorldObject.__init__(self, level, x, y,
|
||||
direction=direction, movable=movable)
|
||||
self.is_currently_opaque = True
|
||||
|
||||
self.frame = 0
|
||||
self.anim_speed = 15
|
||||
|
@ -109,6 +115,7 @@ class RisingBlock(Block):
|
|||
def __init__(self, level, x, y, movable=False, is_up=True):
|
||||
self.__dict__.update(locals())
|
||||
worldobject.WorldObject.__init__(self, level, x, y, movable=movable)
|
||||
self.is_currently_opaque = True
|
||||
|
||||
self.frame = 0
|
||||
self.anim_speed = 15
|
||||
|
|
|
@ -136,9 +136,3 @@ class Level3(level.Level):
|
|||
def restart(self):
|
||||
for obj in self.objects:
|
||||
obj.reset_pos()
|
||||
|
||||
def infrange():
|
||||
n = 0
|
||||
while True:
|
||||
yield n
|
||||
n += 1
|
||||
|
|
Loading…
Reference in New Issue