use of com.watabou.pixeldungeon.effects.Flare in project pixel-dungeon by watabou.
the class AboutScene method create.
@Override
public void create() {
super.create();
BitmapTextMultiline text = createMultiline(TXT, 8);
text.maxWidth = Math.min(Camera.main.width, 120);
text.measure();
add(text);
text.x = align((Camera.main.width - text.width()) / 2);
text.y = align((Camera.main.height - text.height()) / 2);
BitmapTextMultiline link = createMultiline(LNK, 8);
link.maxWidth = Math.min(Camera.main.width, 120);
link.measure();
link.hardlight(Window.TITLE_COLOR);
add(link);
link.x = text.x;
link.y = text.y + text.height();
TouchArea hotArea = new TouchArea(link) {
@Override
protected void onClick(Touch touch) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://" + LNK));
Game.instance.startActivity(intent);
}
};
add(hotArea);
Image wata = Icons.WATA.get();
wata.x = align((Camera.main.width - wata.width) / 2);
wata.y = text.y - wata.height - 8;
add(wata);
new Flare(7, 64).color(0x112233, true).show(wata, 0).angularSpeed = +20;
Archs archs = new Archs();
archs.setSize(Camera.main.width, Camera.main.height);
addToBack(archs);
ExitButton btnExit = new ExitButton();
btnExit.setPos(Camera.main.width - btnExit.width(), 0);
add(btnExit);
fadeIn();
}
use of com.watabou.pixeldungeon.effects.Flare in project pixel-dungeon by watabou.
the class AmuletScene method create.
@Override
public void create() {
super.create();
BitmapTextMultiline text = null;
if (!noText) {
text = createMultiline(TXT, 8);
text.maxWidth = WIDTH;
text.measure();
add(text);
}
amulet = new Image(Assets.AMULET);
add(amulet);
RedButton btnExit = new RedButton(TXT_EXIT) {
@Override
protected void onClick() {
Dungeon.win(ResultDescriptions.WIN);
Dungeon.deleteGame(Dungeon.hero.heroClass, true);
Game.switchScene(noText ? TitleScene.class : RankingsScene.class);
}
};
btnExit.setSize(WIDTH, BTN_HEIGHT);
add(btnExit);
RedButton btnStay = new RedButton(TXT_STAY) {
@Override
protected void onClick() {
onBackPressed();
}
};
btnStay.setSize(WIDTH, BTN_HEIGHT);
add(btnStay);
float height;
if (noText) {
height = amulet.height + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
amulet.x = align((Camera.main.width - amulet.width) / 2);
amulet.y = align((Camera.main.height - height) / 2);
btnExit.setPos((Camera.main.width - btnExit.width()) / 2, amulet.y + amulet.height + LARGE_GAP);
btnStay.setPos(btnExit.left(), btnExit.bottom() + SMALL_GAP);
} else {
height = amulet.height + LARGE_GAP + text.height() + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
amulet.x = align((Camera.main.width - amulet.width) / 2);
amulet.y = align((Camera.main.height - height) / 2);
text.x = align((Camera.main.width - text.width()) / 2);
text.y = amulet.y + amulet.height + LARGE_GAP;
btnExit.setPos((Camera.main.width - btnExit.width()) / 2, text.y + text.height() + LARGE_GAP);
btnStay.setPos(btnExit.left(), btnExit.bottom() + SMALL_GAP);
}
new Flare(8, 48).color(0xFFDDBB, true).show(amulet, 0).angularSpeed = +30;
fadeIn();
}
use of com.watabou.pixeldungeon.effects.Flare in project pixel-dungeon-remix by NYRDS.
the class AboutScene method create.
@Override
public void create() {
super.create();
Text text = createText(getTXT(), null);
text.camera = uiCamera;
text.x = align((Camera.main.width - text.width()) / 2);
text.y = align((Camera.main.height - text.height()) / 3);
Text email = createTouchEmail(Game.getVar(R.string.AboutScene_Mail), text);
Text visit = createText(Game.getVar(R.string.AboutScene_OurSite), email);
Text site = createTouchLink(LNK, visit);
createText("\n" + getTRN(), site);
Image nyrdie = Icons.NYRDIE.get();
nyrdie.x = align(text.x + (text.width() - nyrdie.width) / 2);
nyrdie.y = text.y - nyrdie.height - 8;
add(nyrdie);
new Flare(7, 64).color(0x332211, true).show(nyrdie, 0).angularSpeed = -20;
Archs archs = new Archs();
archs.setSize(Camera.main.width, Camera.main.height);
addToBack(archs);
ExitButton btnExit = new ExitButton();
btnExit.setPos(Camera.main.width - btnExit.width(), 0);
add(btnExit);
fadeIn();
}
use of com.watabou.pixeldungeon.effects.Flare in project pixel-dungeon-remix by NYRDS.
the class AmuletScene method create.
@Override
public void create() {
super.create();
Text text = null;
if (!noText) {
text = createMultiline(TXT, GuiProperties.regularFontSize());
text.maxWidth(WIDTH);
text.measure();
add(text);
}
amulet = new Image(Assets.AMULET);
add(amulet);
RedButton btnExit = new RedButton(TXT_EXIT) {
@Override
protected void onClick() {
Dungeon.win(ResultDescriptions.WIN, Rankings.gameOver.WIN_AMULET);
Dungeon.gameOver();
Game.switchScene(noText ? TitleScene.class : RankingsScene.class);
}
};
btnExit.setSize(WIDTH, BTN_HEIGHT);
add(btnExit);
RedButton btnStay = new RedButton(TXT_STAY) {
@Override
protected void onClick() {
onBackPressed();
}
};
btnStay.setSize(WIDTH, BTN_HEIGHT);
add(btnStay);
float height;
if (noText) {
height = amulet.height + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
amulet.x = align((Camera.main.width - amulet.width) / 2);
amulet.y = align((Camera.main.height - height) / 2);
btnExit.setPos((Camera.main.width - btnExit.width()) / 2, amulet.y + amulet.height + LARGE_GAP);
btnStay.setPos(btnExit.left(), btnExit.bottom() + SMALL_GAP);
} else {
height = amulet.height + LARGE_GAP + text.height() + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
amulet.x = align((Camera.main.width - amulet.width) / 2);
amulet.y = align((Camera.main.height - height) / 2);
text.x = align((Camera.main.width - text.width()) / 2);
text.y = amulet.y + amulet.height + LARGE_GAP;
btnExit.setPos((Camera.main.width - btnExit.width()) / 2, text.y + text.height() + LARGE_GAP);
btnStay.setPos(btnExit.left(), btnExit.bottom() + SMALL_GAP);
}
new Flare(8, 48).color(0xFFDDBB, true).show(amulet, 0).angularSpeed = +30;
fadeIn();
}
use of com.watabou.pixeldungeon.effects.Flare in project pixel-dungeon-remix by NYRDS.
the class GameScene method create.
@Override
public void create() {
playLevelMusic();
Level level = Dungeon.level;
PixelDungeon.lastClass(Dungeon.hero.heroClass.ordinal());
super.create();
Camera.main.zoom((float) (defaultZoom + PixelDungeon.zoom()));
scene = this;
Group terrain = new Group();
add(terrain);
water = new SkinnedBlock(level.getWidth() * DungeonTilemap.SIZE, level.getHeight() * DungeonTilemap.SIZE, level.getWaterTex());
waterSx = DungeonGenerator.getLevelProperty(level.levelId, "waterSx", waterSx);
waterSy = DungeonGenerator.getLevelProperty(level.levelId, "waterSy", waterSy);
terrain.add(water);
ripples = new Group();
terrain.add(ripples);
String logicTilesAtlas = level.getProperty("tiles_logic", null);
if (logicTilesAtlas != null) {
logicTiles = new ClassicDungeonTilemap(level, logicTilesAtlas);
terrain.add(logicTiles);
}
if (!level.customTiles()) {
baseTiles = DungeonTilemap.factory(level, level.getTilesetForLayer(Level.LayerId.Base));
} else {
CustomLayerTilemap tiles = new CustomLayerTilemap(level, Level.LayerId.Base);
tiles.addLayer(Level.LayerId.Deco);
tiles.addLayer(Level.LayerId.Deco2);
baseTiles = tiles;
tiles = new CustomLayerTilemap(level, Level.LayerId.Roof_Base);
tiles.addLayer(Level.LayerId.Roof_Deco);
tiles.setTransparent(true);
roofTiles = tiles;
}
terrain.add(baseTiles);
objects = new Group();
add(objects);
for (int i = 0; i < level.objects.size(); i++) {
SparseArray<LevelObject> objectLayer = level.objects.valueAt(i);
for (int j = 0; j < objectLayer.size(); j++) {
addLevelObjectSprite(objectLayer.valueAt(j));
}
}
level.addVisuals(this);
plants = new Group();
add(plants);
for (int i = 0; i < level.plants.size(); i++) {
addPlantSprite(level.plants.valueAt(i));
}
heaps = new Group();
add(heaps);
for (Heap heap : level.allHeaps()) {
addHeapSprite(heap);
}
emitters = new Group();
effects = new Group();
emoicons = new Group();
mobs = new Group();
add(mobs);
// hack to save bugged saves...
boolean buggedSave = false;
HashSet<Mob> filteredMobs = new HashSet<>();
for (Mob mob : level.mobs) {
if (level.cellValid(mob.getPos())) {
filteredMobs.add(mob);
} else {
buggedSave = true;
}
}
if (buggedSave) {
EventCollector.logEvent(EventCollector.BUG, "bugged save", "mob.pos==-1");
}
level.mobs = filteredMobs;
for (Mob mob : level.mobs) {
if (Statistics.amuletObtained) {
mob.beckon(Dungeon.hero.getPos());
}
}
Dungeon.hero.updateSprite();
add(emitters);
add(effects);
gases = new Group();
add(gases);
for (Blob blob : level.blobs.values()) {
blob.emitter = null;
addBlobSprite(blob);
}
fog = new FogOfWar(level.getWidth(), level.getHeight());
if (level.noFogOfWar()) {
level.reveal();
}
if (roofTiles != null) {
add(roofTiles);
}
fog.updateVisibility(Dungeon.visible, level.visited, level.mapped);
add(fog);
brightness(PixelDungeon.brightness());
spells = new Group();
add(spells);
statuses = new Group();
add(statuses);
add(emoicons);
add(new HealthIndicator());
add(cellSelector = new CellSelector(baseTiles));
Dungeon.hero.updateLook();
sb = new StatusPane(Dungeon.hero, level);
sb.camera = uiCamera;
sb.setSize(uiCamera.width, 0);
add(sb);
toolbar = new Toolbar();
toolbar.camera = uiCamera;
toolbar.setRect(0, uiCamera.height - toolbar.height(), uiCamera.width, toolbar.height());
add(toolbar);
attack = new AttackIndicator();
attack.camera = uiCamera;
attack.setPos(uiCamera.width - attack.width(), toolbar.top() - attack.height());
add(attack);
resume = new ResumeIndicator();
resume.camera = uiCamera;
resume.setPos(uiCamera.width - resume.width(), attack.top() - resume.height());
add(resume);
log = new GameLog();
log.camera = uiCamera;
log.setRect(0, toolbar.top(), attack.left(), 0);
add(log);
if (Dungeon.depth < Statistics.deepestFloor) {
GLog.i(TXT_WELCOME_BACK, Dungeon.depth);
} else {
GLog.i(TXT_WELCOME, Dungeon.depth);
Sample.INSTANCE.play(Assets.SND_DESCEND);
}
switch(level.getFeeling()) {
case CHASM:
GLog.w(TXT_CHASM);
break;
case WATER:
GLog.w(TXT_WATER);
break;
case GRASS:
GLog.w(TXT_GRASS);
break;
default:
}
if (level instanceof RegularLevel && ((RegularLevel) level).secretDoors > Random.IntRange(3, 4)) {
GLog.w(TXT_SECRETS);
}
if (Dungeon.nightMode && !Dungeon.bossLevel()) {
GLog.w(TXT_NIGHT_MODE);
}
busy = new BusyIndicator();
busy.camera = uiCamera;
busy.x = 1;
busy.y = sb.bottom() + 18;
add(busy);
sceneCreated = true;
switch(InterlevelScene.mode) {
case RESURRECT:
WandOfBlink.appear(Dungeon.hero, level.entrance);
new Flare(8, 32).color(0xFFFF66, true).show(Dungeon.hero.getHeroSprite(), 2f);
break;
case RETURN:
WandOfBlink.appear(Dungeon.hero, Dungeon.hero.getPos());
break;
case FALL:
Chasm.heroLand();
break;
case DESCEND:
DungeonGenerator.showStory(level);
if (Dungeon.hero.isAlive() && !level.isSafe() && Dungeon.depth != 22 && Dungeon.depth != 1) {
Badges.validateNoKilling();
}
break;
default:
}
Camera.main.target = Dungeon.hero.getHeroSprite();
level.activateScripts();
fadeIn();
Dungeon.observe();
}
Aggregations