It's awesome!
This commit is contained in:
@@ -42,12 +42,13 @@ class Block(worldobject.WorldObject):
|
||||
self.set_alpha(1)
|
||||
|
||||
def use(self, obj):
|
||||
if obj == self.holder:
|
||||
obj.holding = None
|
||||
self.holder = None
|
||||
else:
|
||||
obj.holding = self
|
||||
self.holder = obj
|
||||
if self.movable:
|
||||
if obj == self.holder:
|
||||
obj.holding = None
|
||||
self.holder = None
|
||||
else:
|
||||
obj.holding = self
|
||||
self.holder = obj
|
||||
|
||||
def draw(self, window):
|
||||
window.blit(self.img, (self.x - 32 - self.level.camera_x,
|
||||
@@ -55,17 +56,27 @@ class Block(worldobject.WorldObject):
|
||||
- self.level.camera_y))
|
||||
|
||||
class ArrowBlock(Block):
|
||||
def __init__(self, level, x, y, anim='arrow_up', movable=True, is_up=True):
|
||||
def __init__(self, level, x, y, direction, movable=True, is_up=True):
|
||||
self.__dict__.update(locals())
|
||||
worldobject.WorldObject.__init__(self, level, x, y, movable=movable)
|
||||
worldobject.WorldObject.__init__(self, level, x, y,
|
||||
direction=direction, movable=movable)
|
||||
|
||||
self.frame = 0
|
||||
self.anim_speed = 15
|
||||
self.setting = False
|
||||
|
||||
if direction == (1, 0):
|
||||
self.anim = 'arrow_right'
|
||||
if direction == (-1, 0):
|
||||
self.anim = 'arrow_left'
|
||||
if direction == (0, -1):
|
||||
self.anim = 'arrow_up'
|
||||
if direction == (0, 1):
|
||||
self.anim = 'arrow_down'
|
||||
|
||||
def activate(self, setting):
|
||||
self.movable = True
|
||||
if self.check_move(0, 0):
|
||||
if not self.share_tile(worldobject.WorldObject):
|
||||
self.is_up = not setting
|
||||
self.movable = False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user