v1.4.0: made various improvements to the short tutorial

This commit is contained in:
Evan Debenham
2022-09-10 12:37:33 -04:00
parent 3dd20df438
commit b9b02fdef8
10 changed files with 117 additions and 44 deletions
@@ -52,8 +52,8 @@ scenes.gamescene.tutorial_move_mobile=Tap a location to to move and interact.
scenes.gamescene.tutorial_move_desktop=Use the mouse or arrow keys to move and interact. scenes.gamescene.tutorial_move_desktop=Use the mouse or arrow keys to move and interact.
scenes.gamescene.tutorial_move_controller=Select a location or use the left stick to move or interact. scenes.gamescene.tutorial_move_controller=Select a location or use the left stick to move or interact.
scenes.gamescene.tutorial_guidebook=Select the blinking journal button to read the book you just picked up. scenes.gamescene.tutorial_guidebook=Select the blinking journal button to read the book you just picked up.
scenes.gamescene.tutorial_ui_mobile=Hero info is on the top left, and your inventory and game actions are below, good luck! scenes.gamescene.tutorial_ui_mobile=Hero info is on the top left. Inventory, quickslots, and game actions are below. Good luck!
scenes.gamescene.tutorial_ui_desktop=Hero info is below, and your inventory and game actions are to the right, good luck! scenes.gamescene.tutorial_ui_desktop=Hero info is below. Inventory, quickslots, and game actions are to the right. Good luck!
scenes.heroselectscene.title=Choose Your Hero scenes.heroselectscene.title=Choose Your Hero
scenes.heroselectscene.options=Game Options scenes.heroselectscene.options=Game Options
@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty;
@@ -67,6 +68,7 @@ public class Hunger extends Buff implements Hero.Doom {
if (Dungeon.level.locked if (Dungeon.level.locked
|| target.buff(WellFed.class) != null || target.buff(WellFed.class) != null
|| SPDSettings.intro()
|| target.buff(ScrollOfChallenge.ChallengeArena.class) != null){ || target.buff(ScrollOfChallenge.ChallengeArena.class) != null){
spend(STEP); spend(STEP);
return true; return true;
@@ -871,7 +871,8 @@ public class Hero extends Char {
if (item instanceof Dewdrop if (item instanceof Dewdrop
|| item instanceof TimekeepersHourglass.sandBag || item instanceof TimekeepersHourglass.sandBag
|| item instanceof DriedRose.Petal || item instanceof DriedRose.Petal
|| item instanceof Key) { || item instanceof Key
|| item instanceof Guidebook) {
//Do Nothing //Do Nothing
} else { } else {
@@ -25,9 +25,11 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.journal.Document; import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.GameLog; import com.shatteredpixel.shatteredpixeldungeon.ui.GameLog;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
public class Guidebook extends Item { public class Guidebook extends Item {
@@ -39,6 +41,9 @@ public class Guidebook extends Item {
@Override @Override
public final boolean doPickUp(Hero hero, int pos) { public final boolean doPickUp(Hero hero, int pos) {
GameScene.pickUpJournal(this, pos); GameScene.pickUpJournal(this, pos);
//we do this here so it appears before the tutorial text
GLog.i( Messages.capitalize(Messages.get(Hero.class, "you_now_have", name())) );
GLog.p(Messages.get(GameScene.class, "tutorial_guidebook"));
GameScene.flashForDocument(Document.ADVENTURERS_GUIDE, Document.GUIDE_INTRO); GameScene.flashForDocument(Document.ADVENTURERS_GUIDE, Document.GUIDE_INTRO);
Sample.INSTANCE.play( Assets.Sounds.ITEM ); Sample.INSTANCE.play( Assets.Sounds.ITEM );
hero.spendAndNext( TIME_TO_PICK_UP ); hero.spendAndNext( TIME_TO_PICK_UP );
@@ -129,6 +129,7 @@ import com.watabou.noosa.Visual;
import com.watabou.noosa.audio.Music; import com.watabou.noosa.audio.Music;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.particles.Emitter; import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.tweeners.Tweener;
import com.watabou.utils.Callback; import com.watabou.utils.Callback;
import com.watabou.utils.DeviceCompat; import com.watabou.utils.DeviceCompat;
import com.watabou.utils.GameMath; import com.watabou.utils.GameMath;
@@ -482,21 +483,6 @@ public class GameScene extends PixelScene {
&& (InterlevelScene.mode == InterlevelScene.Mode.DESCEND || InterlevelScene.mode == InterlevelScene.Mode.FALL)) { && (InterlevelScene.mode == InterlevelScene.Mode.DESCEND || InterlevelScene.mode == InterlevelScene.Mode.FALL)) {
GLog.h(Messages.get(this, "descend"), Dungeon.depth); GLog.h(Messages.get(this, "descend"), Dungeon.depth);
Sample.INSTANCE.play(Assets.Sounds.DESCEND); Sample.INSTANCE.play(Assets.Sounds.DESCEND);
//Tutorial
if (SPDSettings.intro()){
if (ControllerHandler.isControllerConnected()){
GLog.p(Messages.get(GameScene.class, "tutorial_move_controller"));
} else if (SPDSettings.interfaceSize() == 0){
GLog.p(Messages.get(GameScene.class, "tutorial_move_mobile"));
} else {
GLog.p(Messages.get(GameScene.class, "tutorial_move_desktop"));
}
toolbar.visible = false;
status.visible = false;
if (inventory != null) inventory.visible = false;
}
for (Char ch : Actor.chars()){ for (Char ch : Actor.chars()){
if (ch instanceof DriedRose.GhostHero){ if (ch instanceof DriedRose.GhostHero){
@@ -585,6 +571,21 @@ public class GameScene extends PixelScene {
} }
//Tutorial
if (SPDSettings.intro()){
if (ControllerHandler.isControllerConnected()){
GLog.p(Messages.get(GameScene.class, "tutorial_move_controller"));
} else if (SPDSettings.interfaceSize() == 0){
GLog.p(Messages.get(GameScene.class, "tutorial_move_mobile"));
} else {
GLog.p(Messages.get(GameScene.class, "tutorial_move_desktop"));
}
toolbar.visible = false;
status.visible = false;
if (inventory != null) inventory.visible = false;
}
if (Rankings.INSTANCE.totalNumber > 0 && !Document.ADVENTURERS_GUIDE.isPageRead(Document.GUIDE_DIEING)){ if (Rankings.INSTANCE.totalNumber > 0 && !Document.ADVENTURERS_GUIDE.isPageRead(Document.GUIDE_DIEING)){
GLog.p(Messages.get(Guidebook.class, "hint")); GLog.p(Messages.get(Guidebook.class, "hint"));
GameScene.flashForDocument(Document.ADVENTURERS_GUIDE, Document.GUIDE_DIEING); GameScene.flashForDocument(Document.ADVENTURERS_GUIDE, Document.GUIDE_DIEING);
@@ -1046,24 +1047,27 @@ public class GameScene extends PixelScene {
public static void flashForDocument( Document doc, String page ){ public static void flashForDocument( Document doc, String page ){
if (scene != null) { if (scene != null) {
scene.menu.flashForPage( doc, page ); scene.menu.flashForPage( doc, page );
//we use a callback here so that regular pickup text appears first
if (SPDSettings.intro()) {
Game.runOnRenderThread(new Callback() {
@Override
public void call() {
GLog.p(Messages.get(GameScene.class, "tutorial_guidebook"));
}
});
}
} }
} }
public static void endIntro(){ public static void endIntro(){
if (scene != null){ if (scene != null){
SPDSettings.intro(false); SPDSettings.intro(false);
//TODO this is very sudden, should have UI and doors fade in scene.add(new Tweener(scene, 2f){
scene.status.visible = true; @Override
scene.toolbar.visible = true; protected void updateValues(float progress) {
if (progress <= 0.5f) {
scene.status.alpha(2*progress);
scene.status.visible = true;
scene.toolbar.visible = false;
} else {
scene.status.alpha(1f);
scene.status.visible = true;
scene.toolbar.alpha((progress - 0.5f)*2);
scene.toolbar.visible = true;
}
}
});
if (scene.inventory != null) scene.inventory.visible = true; if (scene.inventory != null) scene.inventory.visible = true;
GameLog.wipe(); GameLog.wipe();
if (SPDSettings.interfaceSize() == 0){ if (SPDSettings.interfaceSize() == 0){
@@ -1076,6 +1080,7 @@ public class GameScene extends PixelScene {
for (int i = 0; i < Dungeon.level.length(); i++){ for (int i = 0; i < Dungeon.level.length(); i++){
if (Dungeon.level.map[i] == Terrain.SECRET_DOOR){ if (Dungeon.level.map[i] == Terrain.SECRET_DOOR){
Dungeon.level.discover(i); Dungeon.level.discover(i);
discoverTile(i, Terrain.SECRET_DOOR);
} }
} }
} }
@@ -166,6 +166,14 @@ public class ItemSlot extends Button {
} }
public void alpha( float value ){
if (sprite != null) sprite.alpha(value);
if (extra != null) extra.alpha(value);
if (status != null) status.alpha(value);
if (itemIcon != null) itemIcon.alpha(value);
if (level != null) level.alpha(value);
}
public void clear(){ public void clear(){
item(null); item(null);
enable(true); enable(true);
@@ -166,6 +166,10 @@ public class QuickSlotButton extends Button {
PixelScene.align(crossB); PixelScene.align(crossB);
} }
public void alpha( float value ){
slot.alpha(value);
}
@Override @Override
public void update() { public void update() {
super.update(); super.update();
@@ -44,6 +44,7 @@ import com.watabou.noosa.NinePatch;
import com.watabou.noosa.particles.Emitter; import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.ui.Component; import com.watabou.noosa.ui.Component;
import com.watabou.utils.ColorMath; import com.watabou.utils.ColorMath;
import com.watabou.utils.GameMath;
import java.util.ArrayList; import java.util.ArrayList;
@@ -318,6 +319,22 @@ public class StatusPane extends Component {
counter.setSweep((1f - Actor.now()%1f)%1f); counter.setSweep((1f - Actor.now()%1f)%1f);
} }
public void alpha( float value ){
value = GameMath.gate(0, value, 1f);
bg.alpha(value);
avatar.alpha(value);
rawShielding.alpha(0.5f*value);
shieldedHP.alpha(value);
hp.alpha(value);
hpText.alpha(0.6f*value);
exp.alpha(value);
if (expText != null) expText.alpha(0.6f*value);
level.alpha(value);
compass.alpha(value);
busy.alpha(value);
counter.alpha(value);
}
public void showStarParticles(){ public void showStarParticles(){
Emitter emitter = (Emitter)recycle( Emitter.class ); Emitter emitter = (Emitter)recycle( Emitter.class );
emitter.revive(); emitter.revive();
@@ -638,7 +638,17 @@ public class Toolbar extends Component {
btnInventory.enable(true); btnInventory.enable(true);
} }
} }
public void alpha( float value ){
btnWait.alpha( value );
btnSearch.alpha( value );
btnInventory.alpha( value );
for (QuickslotTool tool : btnQuick){
tool.alpha(value);
}
btnSwap.alpha( value );
}
public void pickup( Item item, int cell ) { public void pickup( Item item, int cell ) {
pickedUp.reset( item, pickedUp.reset( item,
cell, cell,
@@ -695,7 +705,11 @@ public class Toolbar extends Component {
base.x = x; base.x = x;
base.y = y; base.y = y;
} }
public void alpha( float value ){
base.alpha(value);
}
@Override @Override
protected void onPointerDown() { protected void onPointerDown() {
base.brightness( 1.4f ); base.brightness( 1.4f );
@@ -747,7 +761,13 @@ public class Toolbar extends Component {
slot.setRect( x, y, width, height ); slot.setRect( x, y, width, height );
slot.slotMargins(borderLeft, 2, borderRight, 2); slot.slotMargins(borderLeft, 2, borderRight, 2);
} }
@Override
public void alpha(float value) {
super.alpha(value);
slot.alpha(value);
}
@Override @Override
public void enable( boolean value ) { public void enable( boolean value ) {
super.enable( value && visible ); super.enable( value && visible );
@@ -849,6 +869,14 @@ public class Toolbar extends Component {
updateVisuals(); updateVisuals();
} }
@Override
public void alpha(float value) {
super.alpha(value);
for (Image im : icons){
if (im != null) im.alpha(value);
}
}
@Override @Override
public void enable(boolean value) { public void enable(boolean value) {
super.enable(value); super.enable(value);
@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress; import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@@ -110,18 +111,20 @@ public class WndGame extends Window {
} }
// Main menu // Main menu
addButton(curBtn = new RedButton( Messages.get(this, "menu") ) { if (!SPDSettings.intro()) {
@Override addButton(curBtn = new RedButton(Messages.get(this, "menu")) {
protected void onClick() { @Override
try { protected void onClick() {
Dungeon.saveAll(); try {
} catch (IOException e) { Dungeon.saveAll();
ShatteredPixelDungeon.reportException(e); } catch (IOException e) {
ShatteredPixelDungeon.reportException(e);
}
Game.switchScene(TitleScene.class);
} }
Game.switchScene(TitleScene.class); });
} curBtn.icon(Icons.get(Icons.DISPLAY));
} ); }
curBtn.icon(Icons.get(Icons.DISPLAY));
resize( WIDTH, pos ); resize( WIDTH, pos );
} }