Reasons to love Python

It let's you do twisted things like this:

waves = [[Clown, Clown, Clown],
	[Clown, Tank, Bunny, Clown],
	[Clown, Tank, Tank, Clown],
	[Clown, Tank, Tank, Bunny],
	[Tank, Tank, Tank, Clown],
	...
	]

where Clown, Tank and Bunny are the Types of the various enemies
and later...

for enemy in waves[wave]:
	enemy(xpos, ypos, 0, 0, self.target)

and it just figures it out and calls the constructor for the relevant type.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.