Thursday, July 11, 2013

June 12: Monster Spawning and Threading

Hey guys!

My work today wasn't groundbreaking, but it's a start. With the help of this post, I managed to create a MonsterSpawner thread, whose implementation looks something like this:
        self.monsterThread1 = MonsterSpawner( "Spawner", self.screen, self, 0.5, 100, [0,300], self.player)
        self.monsterThread2 = MonsterSpawner( "Spawner2", self.screen, self, 1, 100, [800,0], self.player)
        self.monsterThread3 = MonsterSpawner( "Spawner3", self.screen, self, 0.25, 100, [400,0], self.player)
        self.monsterThread4 = MonsterSpawner( "Spawner4", self.screen, self, 0.1, 100, [400,600], self.player)
        self.monsterThread1.start()
        self.monsterThread2.start()
        self.monsterThread3.start()
        self.monsterThread4.start()
There's no collision just yet (neither with the players, his arrows, nor the other monsters), and the AI is simple: chase the player. Tomorrow's goal is adding slightly more complex AI and collision and unit killing. Here's a short clip showing off the different spawn locations and spawn rates:

 Thanks for reading!

No comments:

Post a Comment