Exemple #1
0
        public void populateLevel()
        {
            int c1 = (map.width - MAIN_ROOM_SIZE) / 2;
            int c2 = (map.height - MAIN_ROOM_SIZE) / 2;
            int c3 = (map.width + MAIN_ROOM_SIZE) / 2;
            int c4 = (map.height + MAIN_ROOM_SIZE) / 2;

            addActor(c1 + 1, c2 + 1, "Wall Torch");
            addActor(c1 + 1, c4 - 1, "Wall Torch");

            addActor(c3 - 1, c2 + 1, "Wall Torch");
            addActor(c3 - 1, c4 - 1, "Wall Torch");

            Actor[] actors = ActorGenerator.getAllActorsOfType("items*");
            int     i      = actors.Length - 1;
            int     j      = c1 + 2;
            int     k      = c2 + 2;

            while (i > 0)
            {
                addActor(j, k, actors[i].name);
                j++;
                if (j > MAIN_ROOM_SIZE)
                {
                    j = c1 + 2;
                    k++;
                }
                i--;
            }
        }
Exemple #2
0
        public void addRandomActorOfType(int x, int y, string type)
        {
            Actor a = ActorGenerator.getRandomActorOfType(type);

            if (a != null)
            {
                a.x = x;
                a.y = y;
                level.actorHandler.addActor(a);
                level.actorHandler.sendToBack(a);
            }
        }