com.watabou.noosa.Game Java Examples
The following examples show how to use
com.watabou.noosa.Game.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WndWandmaker.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
private void selectReward( WandMaker wandmaker, Item item, Wand reward ) { hide(); item.removeItemFrom(Dungeon.hero); reward.identify(); if (reward.doPickUp( Dungeon.hero )) { GLog.i( Hero.getHeroYouNowHave(), reward.name() ); } else { reward.doDrop(wandmaker); } wandmaker.say(Utils.format( Game.getVar(R.string.WndWandmaker_Farawell), Dungeon.hero.className() ) ); wandmaker.destroy(); wandmaker.getSprite().die(); WandMaker.Quest.complete(); }
Example #2
Source File: Dungeon.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
public static String tip(Level _level) { if (_level instanceof DeadEndLevel) { return Game.getVar(R.string.Dungeon_DeadEnd); } else { String[] tips = Game.getVars(R.array.Dungeon_Tips); int index = depth - 1; if (index == -1) { return "Welcome to test level"; } if (index < tips.length) { return tips[index]; } else { return Game.getVar(R.string.Dungeon_NoTips); } } }
Example #3
Source File: WndSadGhost.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
private void selectReward(Ghost ghost, @NotNull Item item, @NotNull Item reward ) { hide(); item.removeItemFrom(Dungeon.hero); if (reward.doPickUp( Dungeon.hero )) { GLog.i( Hero.getHeroYouNowHave(), reward.name() ); } else { reward.doDrop(ghost); } ghost.say( Game.getVar(R.string.WndSadGhost_Farewell) ); ghost.die( null ); Ghost.Quest.complete(); }
Example #4
Source File: TitleScene.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
@Override public void update() { super.update(); time += Game.elapsed; float cl = (float) Math.sin(time) * 0.5f + 0.5f; if(!donationAdded) { if (RemixedDungeon.canDonate()) { add(pleaseSupport); add(btnDonate); } donationAdded = true; } else { pleaseSupport.hardlight(cl, cl, cl); } if(changelogUpdated) { btnChangelog.brightness(cl + 1); } }
Example #5
Source File: Archs.java From pixel-dungeon with GNU General Public License v3.0 | 6 votes |
@Override public void update() { super.update(); float shift = Game.elapsed * SCROLL_SPEED; if (reversed) { shift = -shift; } arcsBg.offset( 0, shift ); arcsFg.offset( 0, shift * 2 ); offsB = arcsBg.offsetY(); offsF = arcsFg.offsetY(); }
Example #6
Source File: WndStory.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 6 votes |
public static void showChapter( int id ) { if (Dungeon.chapters.contains( id )) { return; } String text = CHAPTERS.get( id ); if (text != null) { WndStory wnd = new WndStory( text ); if ((wnd.delay = 0.6f) > 0) { wnd.shadow.visible = wnd.chrome.visible = wnd.tf.visible = false; } Game.scene().add( wnd ); Dungeon.chapters.add( id ); } }
Example #7
Source File: Chasm.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
public static void heroJump( final Hero hero ) { GameScene.show( new WndOptions( Game.getVar(R.string.Chasm_Chasm), Game.getVar(R.string.Chasm_Jump), Game.getVar(R.string.Chasm_Yes), Game.getVar(R.string.Chasm_No) ) { @Override public void onSelect(int index) { if (index == 0) { jumpConfirmed = true; hero.resume(); } } } ); }
Example #8
Source File: Badges.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
private static void unlockPlayGamesBadge(Badge badge) { if (playGamesList.contains(badge) && !ModdingMode.inMod()) { String achievementCode = StringsManager.getVar("achievement_" + badge.name().toLowerCase(Locale.ROOT)); if(achievementCode.isEmpty()) { EventCollector.logException("empty achievement " + badge.name()); return; } if(Preferences.INSTANCE.getBoolean(achievementCode,false)) { return; } Preferences.INSTANCE.put(achievementCode,true); Game.instance().playGames.unlockAchievement(achievementCode); } }
Example #9
Source File: WndStory.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 6 votes |
public static void showChapter( int id ) { if (Dungeon.chapters.contains( id )) { return; } String text = CHAPTERS.get( id ); if (text != null) { WndStory wnd = new WndStory( text ); if ((wnd.delay = 0.6f) > 0) { wnd.shadow.visible = wnd.chrome.visible = wnd.tf.visible = false; } Game.scene().add( wnd ); Dungeon.chapters.add( id ); } }
Example #10
Source File: Toolbar.java From pixel-dungeon with GNU General Public License v3.0 | 6 votes |
@Override public void update() { super.update(); if ((left -= Game.elapsed) <= 0) { visible = active = false; } else { float p = left / DURATION; scale.set( (float)Math.sqrt( p ) ); float offset = DISTANCE * p; x = dstX - offset; y = dstY - offset; } }
Example #11
Source File: ChallengeButton.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
@Override protected void onClick() { if (Badges.isUnlocked(Badges.Badge.VICTORY) || BuildConfig.DEBUG) { parentScene.add(new WndChallenges( RemixedDungeon.challenges(), true) { public void onBackPressed() { super.onBackPressed(); image.copy(Icons.get(RemixedDungeon.challenges() > 0 ? Icons.CHALLENGE_ON : Icons.CHALLENGE_OFF)); } }); } else { parentScene.add(new WndMessage(Game .getVar(R.string.StartScene_WinGame))); } }
Example #12
Source File: AttackIndicator.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 6 votes |
@Override public synchronized void update() { super.update(); if (!bg.visible){ enable(false); if (delay > 0f) delay -= Game.elapsed; if (delay <= 0f) active = false; } else { delay = 0.75f; active = true; if (Dungeon.hero.isAlive()) { enable(Dungeon.hero.ready); } else { visible( false ); enable( false ); } } }
Example #13
Source File: Level.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 6 votes |
@Override public void storeInBundle( Bundle bundle ) { bundle.put( VERSION, Game.versionCode ); bundle.put( WIDTH, width ); bundle.put( HEIGHT, height ); bundle.put( MAP, map ); bundle.put( VISITED, visited ); bundle.put( MAPPED, mapped ); bundle.put( ENTRANCE, entrance ); bundle.put( EXIT, exit ); bundle.put( LOCKED, locked ); bundle.put( HEAPS, heaps.valueList() ); bundle.put( PLANTS, plants.valueList() ); bundle.put( TRAPS, traps.valueList() ); bundle.put( CUSTOM_TILES, customTiles ); bundle.put( CUSTOM_WALLS, customWalls ); bundle.put( MOBS, mobs ); bundle.put( BLOBS, blobs.values() ); bundle.put( FEELING, feeling ); bundle.put( "mobs_to_spawn", mobsToSpawn.toArray(new Class[0])); }
Example #14
Source File: WndStory.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 6 votes |
public static void showChapter( int id ) { if (Dungeon.chapters.contains( id )) { return; } String text = Messages.get(WndStory.class, CHAPTERS.get( id )); if (text != null) { WndStory wnd = new WndStory( text ); if ((wnd.delay = 0.6f) > 0) { wnd.shadow.visible = wnd.chrome.visible = wnd.tf.visible = false; } Game.scene().add( wnd ); Dungeon.chapters.add( id ); } }
Example #15
Source File: PrisonBossLevel.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public String tileName( int tile ) { switch (tile) { case Terrain.WATER: return Game.getVar(R.string.Prison_TileWater); default: return super.tileName( tile ); } }
Example #16
Source File: ExitButton.java From pixel-dungeon with GNU General Public License v3.0 | 5 votes |
@Override protected void onClick() { if (Game.scene() instanceof TitleScene) { Game.instance.finish(); } else { PixelDungeon.switchNoFade( TitleScene.class ); } }
Example #17
Source File: Beam.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
@Override public void update() { super.update(); float p = timeLeft / duration; alpha( p ); scale.set( scale.x, p ); if ((timeLeft -= Game.elapsed) <= 0) { killAndErase(); } }
Example #18
Source File: Ring.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public boolean attachTo( Char target ) { if (target.getHeroClass() == HeroClass.ROGUE && !isKnown()) { setKnown(); GLog.i( Game.getVar(R.string.Ring_BuffKnown), Ring.this.trueName() ); Badges.validateItemLevelAcquired( Ring.this ); } return super.attachTo(target); }
Example #19
Source File: WndTradeItem.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
private float createDescription( Item item, boolean buying ) { // Title IconTitle titlebar = new IconTitle(); titlebar.icon( new ItemSprite( item ) ); titlebar.label( buying ? Utils.format( Game.getVar(R.string.WndTradeItem_Sale), item.toString(), price( item, true ) ) : Utils.capitalize( item.toString() ) ); titlebar.setRect( 0, 0, WIDTH, 0 ); add( titlebar ); // Upgraded / degraded if (item.isLevelKnown() && item.level() > 0) { titlebar.color( ItemSlot.UPGRADED ); } else if (item.isLevelKnown() && item.level() < 0) { titlebar.color( ItemSlot.DEGRADED ); } // Description Text info = PixelScene.createMultiline( item.info(), GuiProperties.regularFontSize() ); info.maxWidth(WIDTH); info.x = titlebar.left(); info.y = titlebar.bottom() + GAP; add( info ); return info.y + info.height(); }
Example #20
Source File: Imp.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
private void tell( String text ) { Game.runOnRenderThread(new Callback() { @Override public void call() { GameScene.show( new WndQuest( Imp.this, text )); } }); }
Example #21
Source File: Dungeon.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public static void saveLevel() throws IOException { Bundle bundle = new Bundle(); bundle.put(LEVEL, level); OutputStream output = Game.instance.openFileOutput( Utils.format( depthFile( hero.heroClass ), depth ), Game.MODE_PRIVATE ); Bundle.write( bundle, output ); output.close(); }
Example #22
Source File: Hero.java From pixel-dungeon with GNU General Public License v3.0 | 5 votes |
private boolean actAscend( HeroAction.Ascend action ) { int stairs = action.dst; if (pos == stairs && pos == Dungeon.level.entrance) { if (Dungeon.depth == 1) { if (belongings.getItem( Amulet.class ) == null) { GameScene.show( new WndMessage( TXT_LEAVE ) ); ready(); } else { Dungeon.win( ResultDescriptions.WIN ); Dungeon.deleteGame( Dungeon.hero.heroClass, true ); Game.switchScene( SurfaceScene.class ); } } else { curAction = null; Hunger hunger = buff( Hunger.class ); if (hunger != null && !hunger.isStarving()) { hunger.satisfy( -Hunger.STARVING / 10 ); } InterlevelScene.mode = InterlevelScene.Mode.ASCEND; Game.switchScene( InterlevelScene.class ); } return false; } else if (getCloser( stairs )) { return true; } else { ready(); return false; } }
Example #23
Source File: RankingsScene.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
@Override protected void onClick() { // DSM-xxxx - try this next part... if (Game.instance.getFileStreamPath(rec.gameFile).exists()) { if (rec.gameFile.length() > 0) { GLog.i("Record: " + rec.gameFile); parent.add(new WndRanking(rec.gameFile)); } else { parent.add(new WndError(TXT_NO_INFO)); } } }
Example #24
Source File: Util.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
static public boolean isConnectedToInternet() { boolean connectionStatus; ConnectivityManager connectivityManager = (ConnectivityManager) Game.instance().getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); connectionStatus = activeNetworkInfo != null && activeNetworkInfo.isConnected(); return connectionStatus; }
Example #25
Source File: StartScene.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public void update() { super.update(); if (brightness < 1.0f && brightness > MIN_BRIGHTNESS) { if ((brightness -= Game.elapsed) <= MIN_BRIGHTNESS) { brightness = MIN_BRIGHTNESS; } updateBrightness(); } }
Example #26
Source File: Fleeing.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public String status(@NotNull Mob me) { Char enemy = me.getEnemy(); if(enemy != CharsList.DUMMY) { return Utils.format(Game.getVar(R.string.Mob_StaFleeingStatus2), me.getName(), enemy.getName_objective()); } return Utils.format(Game.getVar(R.string.Mob_StaFleeingStatus), me.getName()); }
Example #27
Source File: SpiderWeb.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 5 votes |
@Override public void update() { super.update(); time += Game.elapsed; scale.set( 0.95f + (float)Math.sin( time ) * 0.05f ); }
Example #28
Source File: ScrollOfSummoning.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
@Override protected void doRead(@NotNull Char reader) { Level level = Dungeon.level; if(level.isBossLevel() || !level.cellValid(level.randomRespawnCell())) { GLog.w( Utils.format(R.string.Using_Failed_Because_Magic, this.name()) ); return; } int cell = level.getEmptyCellNextTo(reader.getPos()); if(level.cellValid(cell)){ Mob mob = Bestiary.mob( level ); GLog.i(Game.getVar(R.string.ScrollOfSummoning_Info_2)); if(mob.canBePet()){ Mob.makePet(mob, reader.getId()); } else { GLog.w( Utils.format(R.string.Mob_Cannot_Be_Pet, mob.getName())); } WandOfBlink.appear( mob, cell ); } else { GLog.w(Game.getVar(R.string.No_Valid_Cell)); } setKnown(); SpellSprite.show( reader, SpellSprite.SUMMON ); Sample.INSTANCE.play( Assets.SND_READ ); Invisibility.dispel(reader); reader.spendAndNext( TIME_TO_READ ); }
Example #29
Source File: BattleMageArmor.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public boolean doEquip(Char hero) { if (hero.getSubClass() == HeroSubClass.BATTLEMAGE) { return super.doEquip(hero); } else { GLog.w(Game.getVar(R.string.MageArmor_NotMage)); return false; } }
Example #30
Source File: PrisonLevel.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public String tileDesc(int tile) { switch (tile) { case Terrain.EMPTY_DECO: return Game.getVar(R.string.Prison_TileDescDeco); case Terrain.BOOKSHELF: return Game.getVar(R.string.Prison_TileDescBookshelf); default: return super.tileDesc( tile ); } }