Example #1
0
	def __init__(self, filename, n_horizontal, n_vertical):
		if filename != None:
			image = Image(filename)
			image.ox = 0
			image.oy = 0
		else:
			image = None
		tiles = []
		TILE_W = 32
		TILE_H = 32
		self.raft = 4
		self.wood = 69
		self.grass = 13
		solid_tiles = [ 64, 66, 68, 69, 72, 73, 76, 77,
			24, 
			28,
			    37,
			44, 45, 46,
			# TODO add more tiles as solid...
		]
		rotateable_tiles = [
			self.wood
		]

		for s in range(4):
			for y in range(n_vertical):
					for x in range(n_horizontal/4):
						xp = s*4+x
						tile = Tile(image, (xp*TILE_W, y*TILE_H, (xp+1)*TILE_W, (y+1)*TILE_H))
						tiles.append(tile)
		for s in solid_tiles:
			tiles[s].solid = True
		for s in rotateable_tiles:
			tiles[s].rotateable = True
		self.tiles = tiles
Example #2
0
	def __init__(self, filename, n_horizontal, n_vertical):
		if filename != None:
			image = Image(filename)
			image.ox = 0
			image.oy = 0
		else:
			image = None

		TILE_W = 64
		TILE_H = 64

		sprites = []
		for y in range(n_vertical):
			for x in range(n_horizontal):
				sprite = PlayerSprite(image, (x*TILE_W, y*TILE_H, (x+1)*TILE_W, (y+1)*TILE_H))
				sprites.append(sprite)

		self.sprites = sprites