Esempio n. 1
0
    def newgame(self):
        self.game = Game((156, 104, 128))
        user = Player(self.game.world)
        
        for i in range(20):
            x, y = [randint(0, self.game.dimensions[i]-1) for i in range(2)]
            self.game.world.space.maketree((x,y,
                                            self.game.world.space.groundlevel(x,y)))

        kind = (Goblin,Tortoise,SmallSpider)

        for i in range(20):
            race = choice(kind)
            x, y = [randint(0, self.game.dimensions[i]-1) for i in range(2)]
            creature = race(None, (x,y,self.game.world.space.groundlevel(x,y)))
            self.game.schedule(creature)

        for i in range(7):
            x, y = [randint(0, self.game.dimensions[i]-1) for i in range(2)]
            creature = Dwarf(user, (x,y,self.game.world.space.groundlevel(x,y)))
            self.game.schedule(creature)

            x, y = [randint(0, self.game.dimensions[i]-1) for i in range(2)]
            loc = x, y, self.game.world.space.groundlevel(x,y)
            handle = Handle(choice(Wood.__subclasses__()), loc)
            blade = PickaxHead(choice(Metal.__subclasses__()), loc)
            self.game.world.additem(handle)
            self.game.world.additem(blade)

            x, y = [randint(0, self.game.dimensions[i]-1) for i in range(2)]
            loc = x, y, self.game.world.space.groundlevel(x,y)
            handle = Handle(choice(Wood.__subclasses__()), loc)
            blade = AxHead(choice(Metal.__subclasses__()), loc)
            self.game.world.additem(Ax(loc, handle, blade))
                                       

            x, y = [randint(0, self.game.dimensions[i]-1) for i in range(2)]
            self.game.world.additem(Workbench((x,y,
                                            self.game.world.space.groundlevel(x,y)),
                                           choice(Wood.__subclasses__())))

        for i in range(10):
            x, y = [randint(0, self.game.dimensions[i]-1) for i in range(2)]
            self.game.world.additem(Barrel((x,y,
                                            self.game.world.space.groundlevel(x,y)),
                                           choice(Wood.__subclasses__())))

        self.child = Renderer(self.game, user, self.zoom)

        user.foundsettlement('the fortress')