39 If a builder is dropped on a tower placement tile, a tower is built
41 player: the player object
42 current_map: the map object the player is in
43 tile: all objects on a tile (a list of Crossfire objects)
44 builder: the tower builder (a Crossfire object)
46 Returns: True if a tower was built, False otherwise.
49 if ob.Name ==
'tower placement':
52 'build large bullet tower': (
'lbulletwall_1', 1),
53 'build lightning tower': (
'lightningwall_1', 1),
54 'build fire tower': (
'firewall_1', 40)
58 if name
in builder.Name:
59 wall = Crossfire.CreateObjectByName(builders[name][0])
60 wall.Level = builders[name][1]
62 wall.Teleport(current_map, player.X, player.Y)
63 player.Teleport(current_map, player.X, player.Y+1)
72 If an object in tile exists in towerlist, the object is removed
74 tile: all objects on a tile (a list of Crossfire objects)
75 towerlist: bulletwall, firewall, or lightningwall
77 Returns: True if a tower was destroyed, False otherwise.
80 if ob.ArchName
in towerlist:
88 If an object in tile exists in towerlist, the object is replaced with the
89 next direction in towerlist
91 current_map: the map object the player is in
92 tile: all objects on a tile (a list of Crossfire objects)
93 towerlist: bulletwall, firewall, or lightningwall
94 level: the spell level of the tower
96 Returns: True if a tower was replaced, False otherwise.
99 if ob.ArchName
in towerlist:
100 position = towerlist.index(ob.ArchName)
103 if position == len(towerlist)-1:
106 new_position = position+1
109 wall = Crossfire.CreateObjectByName(towerlist[new_position])
110 wall.Teleport(current_map, x, y)
121 Returns all objects in the direction the player faces
123 player: the player object
124 current_map: the map object the player is in
128 Crossfire.Direction.NORTH: (player.X, player.Y-1),
129 Crossfire.Direction.SOUTH: (player.X, player.Y+1),
130 Crossfire.Direction.EAST: (player.X+1, player.Y),
131 Crossfire.Direction.WEST: (player.X-1, player.Y),
132 Crossfire.Direction.NORTHWEST: (player.X-1, player.Y-1),
133 Crossfire.Direction.NORTHEAST: (player.X+1, player.Y-1),
134 Crossfire.Direction.SOUTHWEST: (player.X-1, player.Y+1),
135 Crossfire.Direction.SOUTHEAST: (player.X+1, player.Y+1)
137 x, y = directions[player.Facing]
140 ob = current_map.ObjectAt(x, y)
150 Returns all objects in the tile the player is standing on
152 player: the player object
153 current_map: the map object the player is in
156 ob = current_map.ObjectAt(player.X, player.Y)