def init():
	global myBackground,myMonster, timeStep



	#initialisation de la partie
	timeStep=0.2

	#creation des elements du jeu
	myMonster=monster.create(color=4,
		direction="right",
		x=5.0,
		y=5.0,
		xMax=40.0,
		yMax=40.0,
		speed=3.0
		)

	myBackground=background.create("background.txt")
Ejemplo n.º 2
0
    def place_monsters(self, m):
        """Place monsters on the map."""

        self.monsters = {}
        self.items = {}
        for y, line in enumerate(m):
            for x, tile in enumerate(line):
                urls = self.map_key[tile]
                if urls:
                    for url in urls[1:]:
                        kind, name = url.split(".", 1)
                        if kind == "monster":
                            m = monster.create(self, (x, y), name)
                            if name == 'player':
                                self.player = m
                            m.place((x, y))
                        elif kind == "item":
                            i = item.create(self, name)
                            i.place((x, y))
                        elif kind == "status":
                            self.monsters[(x, y)].add_status(name)