Search in sources :

Example 1 with Point

use of com.watabou.utils.Point in project pixel-dungeon by watabou.

the class Painter method drawInside.

public static Point drawInside(Level level, Room room, Point from, int n, int value) {
    Point step = new Point();
    if (from.x == room.left) {
        step.set(+1, 0);
    } else if (from.x == room.right) {
        step.set(-1, 0);
    } else if (from.y == room.top) {
        step.set(0, +1);
    } else if (from.y == room.bottom) {
        step.set(0, -1);
    }
    Point p = new Point(from).offset(step);
    for (int i = 0; i < n; i++) {
        if (value != -1) {
            set(level, p, value);
        }
        p.offset(step);
    }
    return p;
}
Also used : Point(com.watabou.utils.Point) Point(com.watabou.utils.Point)

Example 2 with Point

use of com.watabou.utils.Point in project pixel-dungeon by watabou.

the class StandardPainter method paintStudy.

private static void paintStudy(Level level, Room room) {
    fill(level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1, Terrain.BOOKSHELF);
    fill(level, room.left + 2, room.top + 2, room.width() - 3, room.height() - 3, Terrain.EMPTY_SP);
    for (Point door : room.connected.values()) {
        if (door.x == room.left) {
            set(level, door.x + 1, door.y, Terrain.EMPTY);
        } else if (door.x == room.right) {
            set(level, door.x - 1, door.y, Terrain.EMPTY);
        } else if (door.y == room.top) {
            set(level, door.x, door.y + 1, Terrain.EMPTY);
        } else if (door.y == room.bottom) {
            set(level, door.x, door.y - 1, Terrain.EMPTY);
        }
    }
    set(level, room.center(), Terrain.PEDESTAL);
}
Also used : Point(com.watabou.utils.Point)

Example 3 with Point

use of com.watabou.utils.Point in project pixel-dungeon by watabou.

the class LaboratoryPainter method paint.

public static void paint(Level level, Room room) {
    fill(level, room, Terrain.WALL);
    fill(level, room, 1, Terrain.EMPTY_SP);
    Room.Door entrance = room.entrance();
    Point pot = null;
    if (entrance.x == room.left) {
        pot = new Point(room.right - 1, Random.Int(2) == 0 ? room.top + 1 : room.bottom - 1);
    } else if (entrance.x == room.right) {
        pot = new Point(room.left + 1, Random.Int(2) == 0 ? room.top + 1 : room.bottom - 1);
    } else if (entrance.y == room.top) {
        pot = new Point(Random.Int(2) == 0 ? room.left + 1 : room.right - 1, room.bottom - 1);
    } else if (entrance.y == room.bottom) {
        pot = new Point(Random.Int(2) == 0 ? room.left + 1 : room.right - 1, room.top + 1);
    }
    set(level, pot, Terrain.ALCHEMY);
    Alchemy alchemy = new Alchemy();
    alchemy.seed(pot.x + Level.WIDTH * pot.y, 1);
    level.blobs.put(Alchemy.class, alchemy);
    int n = Random.IntRange(2, 3);
    for (int i = 0; i < n; i++) {
        int pos;
        do {
            pos = room.random();
        } while (level.map[pos] != Terrain.EMPTY_SP || level.heaps.get(pos) != null);
        level.drop(prize(level), pos);
    }
    entrance.set(Room.Door.Type.LOCKED);
    level.addItemToSpawn(new IronKey());
}
Also used : Alchemy(com.watabou.pixeldungeon.actors.blobs.Alchemy) IronKey(com.watabou.pixeldungeon.items.keys.IronKey) Point(com.watabou.utils.Point) Room(com.watabou.pixeldungeon.levels.Room) Point(com.watabou.utils.Point)

Example 4 with Point

use of com.watabou.utils.Point in project pixel-dungeon by watabou.

the class LibraryPainter method paint.

public static void paint(Level level, Room room) {
    fill(level, room, Terrain.WALL);
    fill(level, room, 1, Terrain.EMPTY);
    Room.Door entrance = room.entrance();
    Point a = null;
    Point b = null;
    if (entrance.x == room.left) {
        a = new Point(room.left + 1, entrance.y - 1);
        b = new Point(room.left + 1, entrance.y + 1);
        fill(level, room.right - 1, room.top + 1, 1, room.height() - 1, Terrain.BOOKSHELF);
    } else if (entrance.x == room.right) {
        a = new Point(room.right - 1, entrance.y - 1);
        b = new Point(room.right - 1, entrance.y + 1);
        fill(level, room.left + 1, room.top + 1, 1, room.height() - 1, Terrain.BOOKSHELF);
    } else if (entrance.y == room.top) {
        a = new Point(entrance.x + 1, room.top + 1);
        b = new Point(entrance.x - 1, room.top + 1);
        fill(level, room.left + 1, room.bottom - 1, room.width() - 1, 1, Terrain.BOOKSHELF);
    } else if (entrance.y == room.bottom) {
        a = new Point(entrance.x + 1, room.bottom - 1);
        b = new Point(entrance.x - 1, room.bottom - 1);
        fill(level, room.left + 1, room.top + 1, room.width() - 1, 1, Terrain.BOOKSHELF);
    }
    if (a != null && level.map[a.x + a.y * Level.WIDTH] == Terrain.EMPTY) {
        set(level, a, Terrain.STATUE);
    }
    if (b != null && level.map[b.x + b.y * Level.WIDTH] == Terrain.EMPTY) {
        set(level, b, Terrain.STATUE);
    }
    int n = Random.IntRange(2, 3);
    for (int i = 0; i < n; i++) {
        int pos;
        do {
            pos = room.random();
        } while (level.map[pos] != Terrain.EMPTY || level.heaps.get(pos) != null);
        level.drop(prize(level), pos);
    }
    entrance.set(Room.Door.Type.LOCKED);
    level.addItemToSpawn(new IronKey());
}
Also used : IronKey(com.watabou.pixeldungeon.items.keys.IronKey) Point(com.watabou.utils.Point) Room(com.watabou.pixeldungeon.levels.Room) Point(com.watabou.utils.Point)

Example 5 with Point

use of com.watabou.utils.Point in project pixel-dungeon by watabou.

the class ScrollPane method layout.

@Override
protected void layout() {
    content.setPos(0, 0);
    controller.x = x;
    controller.y = y;
    controller.width = width;
    controller.height = height;
    Point p = camera().cameraToScreen(x, y);
    Camera cs = content.camera;
    cs.x = p.x;
    cs.y = p.y;
    cs.resize((int) width, (int) height);
    thumb.visible = height < content.height();
    if (thumb.visible) {
        thumb.scale.set(2, height * height / content.height());
        thumb.x = right() - thumb.width();
        thumb.y = y;
    }
}
Also used : Point(com.watabou.utils.Point) Camera(com.watabou.noosa.Camera)

Aggregations

Point (com.watabou.utils.Point)18 Room (com.watabou.pixeldungeon.levels.Room)11 IronKey (com.watabou.pixeldungeon.items.keys.IronKey)6 Camera (com.watabou.noosa.Camera)2 Touch (com.watabou.input.Touchscreen.Touch)1 ColorBlock (com.watabou.noosa.ColorBlock)1 Group (com.watabou.noosa.Group)1 Image (com.watabou.noosa.Image)1 TouchArea (com.watabou.noosa.TouchArea)1 Alchemy (com.watabou.pixeldungeon.actors.blobs.Alchemy)1 SacrificialFire (com.watabou.pixeldungeon.actors.blobs.SacrificialFire)1 WellWater (com.watabou.pixeldungeon.actors.blobs.WellWater)1 Statue (com.watabou.pixeldungeon.actors.mobs.Statue)1 Item (com.watabou.pixeldungeon.items.Item)1 Archs (com.watabou.pixeldungeon.ui.Archs)1 RedButton (com.watabou.pixeldungeon.ui.RedButton)1 ArrayList (java.util.ArrayList)1