Added translucency.
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
A generic block.
|
||||
"""
|
||||
|
||||
import pygame
|
||||
|
||||
import worldobject
|
||||
|
||||
class Block(worldobject.WorldObject):
|
||||
@@ -31,6 +33,14 @@ class Block(worldobject.WorldObject):
|
||||
self.__dict__.update(locals())
|
||||
worldobject.WorldObject.__init__(self, level, x, y, movable=movable)
|
||||
|
||||
self.orig_alpha = pygame.surfarray.array_alpha(self.img)
|
||||
|
||||
def update_alpha(self):
|
||||
if (self.y + self.z >= self.level.player.y + self.level.player.z):
|
||||
self.set_alpha(0.5)
|
||||
else:
|
||||
self.set_alpha(1)
|
||||
|
||||
def use(self, obj):
|
||||
if obj == self.holder:
|
||||
obj.holding = None
|
||||
|
||||
Reference in New Issue
Block a user