Merge branch 'master' of hongabar.org:robotgame

This commit is contained in:
Lasse 2012-08-09 15:31:52 +02:00
commit a63a4034c5
6 changed files with 12 additions and 5 deletions

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -28,6 +28,7 @@ import pygame
import worldobject import worldobject
import block import block
import player
class Boulder(worldobject.WorldObject): class Boulder(worldobject.WorldObject):
def __init__(self, level, x, y, direction=(1, 0), def __init__(self, level, x, y, direction=(1, 0),
@ -40,6 +41,8 @@ class Boulder(worldobject.WorldObject):
self.frame = 0 self.frame = 0
self.anim_speed = 60 self.anim_speed = 60
self.ignore_list.append(player.Player)
def activate(self, setting): def activate(self, setting):
self.rolling = True self.rolling = True

View File

@ -273,6 +273,8 @@ class Level1(level.Level):
moat_list = ['moat_corner_north', moat_list = ['moat_corner_north',
'moat_corner_south', 'moat_corner_south',
'moat_corner_north_flip',
'moat_corner_south_flip',
'moat_end_horizontal', 'moat_end_horizontal',
'moat_horizontal', 'moat_horizontal',
'moat_vertical'] 'moat_vertical']
@ -281,10 +283,6 @@ class Level1(level.Level):
self.graphics_dir, 'moat', '%s.png' % moat)) self.graphics_dir, 'moat', '%s.png' % moat))
# Special treatment # Special treatment
self.imgs['moat_corner_north_flip'] = pygame.transform.flip(
self.imgs['moat_corner_north'], 1, 0)
self.imgs['moat_corner_south_flip'] = pygame.transform.flip(
self.imgs['moat_corner_south'], 1, 0)
self.imgs['moat_end_horizontal_flip'] = pygame.transform.flip( self.imgs['moat_end_horizontal_flip'] = pygame.transform.flip(
self.imgs['moat_end_horizontal'], 1, 0) self.imgs['moat_end_horizontal'], 1, 0)

View File

@ -29,6 +29,7 @@ import re
import os import os
import worldobject import worldobject
import boulder
class Player(worldobject.WorldObject): class Player(worldobject.WorldObject):
def __init__(self, level, x, y, z=1, movable=True): def __init__(self, level, x, y, z=1, movable=True):
@ -41,6 +42,8 @@ class Player(worldobject.WorldObject):
self.frame = 0 self.frame = 0
self.anim_speed = 15 self.anim_speed = 15
self.ignore_list.append(boulder.Boulder)
self.load() self.load()
def load(self): def load(self):

View File

@ -41,6 +41,8 @@ class WorldObject(object):
self.holding = None self.holding = None
self.holder = None self.holder = None
self.ignore_list = []
self.is_currently_opaque = True self.is_currently_opaque = True
if hasattr(self, 'img'): if hasattr(self, 'img'):
@ -73,7 +75,8 @@ class WorldObject(object):
if (obj.x == self.x + move_x * self.tile_x if (obj.x == self.x + move_x * self.tile_x
and obj.y == self.y + move_y * self.tile_y and obj.y == self.y + move_y * self.tile_y
and obj is not self and obj is not self.holder and obj is not self and obj is not self.holder
and obj is not self.holding and obj.blocking): and obj is not self.holding and obj.blocking
and type(obj) not in self.ignore_list):
return False return False
return True return True
return False return False