Improved tutorial, made smooth camera a setting

This commit is contained in:
Anuken
2017-10-16 22:54:11 -04:00
parent 254782c4e8
commit 670d080fae
6 changed files with 95 additions and 19 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -64,9 +64,15 @@ public class Renderer extends RendererModule{
if(GameState.is(State.menu)){ if(GameState.is(State.menu)){
clearScreen(); clearScreen();
}else{ }else{
boolean smoothcam = Settings.getBool("smoothcam");
if(World.core.block() == ProductionBlocks.core){ if(World.core.block() == ProductionBlocks.core){
if(!smoothcam){
setCamera(player.x, player.y);
}else{
smoothCamera(player.x, player.y, android ? 0.3f : 0.14f); smoothCamera(player.x, player.y, android ? 0.3f : 0.14f);
}
}else{ }else{
smoothCamera(World.core.worldx(), World.core.worldy(), 0.4f); smoothCamera(World.core.worldx(), World.core.worldy(), 0.4f);
} }
@@ -88,7 +94,9 @@ public class Renderer extends RendererModule{
float lastx = camera.position.x, lasty = camera.position.y; float lastx = camera.position.x, lasty = camera.position.y;
if(Vars.snapCamera && smoothcam){
camera.position.set((int) camera.position.x, (int) camera.position.y, 0); camera.position.set((int) camera.position.x, (int) camera.position.y, 0);
}
if(Gdx.graphics.getHeight() / Core.cameraScale % 2 == 1){ if(Gdx.graphics.getHeight() / Core.cameraScale % 2 == 1){
camera.position.add(0, -0.5f, 0); camera.position.add(0, -0.5f, 0);
@@ -320,11 +328,13 @@ public class Renderer extends RendererModule{
} }
} }
boolean smoothcam = Settings.getBool("smoothcam");
for(Entity entity : Entities.all()){ for(Entity entity : Entities.all()){
if(entity instanceof DestructibleEntity && !(entity instanceof TileEntity)){ if(entity instanceof DestructibleEntity && !(entity instanceof TileEntity)){
DestructibleEntity dest = ((DestructibleEntity) entity); DestructibleEntity dest = ((DestructibleEntity) entity);
if(dest instanceof Player){ if(dest instanceof Player && Vars.snapCamera && smoothcam){
drawHealth((int)dest.x, (int)dest.y, dest.health, dest.maxhealth); drawHealth((int)dest.x, (int)dest.y, dest.health, dest.maxhealth);
}else{ }else{
drawHealth(dest.x, dest.y, dest.health, dest.maxhealth); drawHealth(dest.x, dest.y, dest.health, dest.maxhealth);

View File

@@ -199,7 +199,7 @@ public class Tutorial{
blockPlaceX = 0; blockPlaceX = 0;
blockPlaceY = -1; blockPlaceY = -1;
targetBlock = ProductionBlocks.conveyor; targetBlock = ProductionBlocks.conveyor;
text = "Use [orange][[R][] to rotate the conveyor to face up, then place it in the [yellow]marked location[] using the [orange][[left mouse button]"; text = "Use [orange][[R][] to rotate the conveyor to face [orange]forwards[], then place it in the [yellow]marked location[] using the [orange][[left mouse button][].";
} }
}, },
placeConveyorAndroid{ placeConveyorAndroid{
@@ -212,7 +212,7 @@ public class Tutorial{
blockPlaceX = 0; blockPlaceX = 0;
blockPlaceY = -1; blockPlaceY = -1;
targetBlock = ProductionBlocks.conveyor; targetBlock = ProductionBlocks.conveyor;
text = "Use the [orange][[rotate button][] to rotate the conveyor to face up, drag it into position with one finger, then place it in the [yellow]marked location[] using the [orange][[checkmark]"; text = "Use the [orange][[rotate button][] to rotate the conveyor to face [orange]forwards[], drag it into position with one finger, then place it in the [yellow]marked location[] using the [orange][[checkmark][].";
} }
}, },
placeConveyorAndroidInfo{ placeConveyorAndroidInfo{
@@ -270,7 +270,7 @@ public class Tutorial{
}, },
drillInfo{ drillInfo{
{ {
text = "Different types of ores require different types of drills. Stone requires stone drills, iron requires iron drills, and so on."; text = "Different ores need different drills. Stone requires stone drills, iron requires iron drills, etc.";
} }
}, },
drillPlaced2{ drillPlaced2{
@@ -365,14 +365,14 @@ public class Tutorial{
pausingDesktop{ pausingDesktop{
{ {
desktopOnly = true; desktopOnly = true;
text = "If you ever feel overwhelmed by enemies, you can press the [orange]pause button[] in the top right or [orange]space[] " text = "If you ever need to take a break, press the [orange]pause button[] in the top right or [orange]space[] "
+ "to pause the game. You can still select and place blocks while paused, but cannot move or shoot."; + "to pause the game. You can still select and place blocks while paused, but cannot move or shoot.";
} }
}, },
pausingAndroid{ pausingAndroid{
{ {
androidOnly = true; androidOnly = true;
text = "If you ever feel overwhelmed by enemies, you can press the [orange]pause button[] in the top right" text = "If you ever need to take a break, press the [orange]pause button[] in the top right"
+ " to pause the game. You can still place select and place blocks while paused."; + " to pause the game. You can still place select and place blocks while paused.";
} }
}, },
@@ -422,7 +422,6 @@ public class Tutorial{
Vars.control.runWave(); Vars.control.runWave();
} }
}, },
/*
pumpDesc{ pumpDesc{
{ {
canBack = false; canBack = false;
@@ -438,7 +437,7 @@ public class Tutorial{
targetBlock = ProductionBlocks.pump; targetBlock = ProductionBlocks.pump;
blockPlaceX = 6; blockPlaceX = 6;
blockPlaceY = -2; blockPlaceY = -2;
text = "Pumps work similarly to drills, except that they produce liquids instead of items. Try placing a pump on the [yellow]designated area[]."; text = "Pumps work similarly to drills, except that they produce liquids instead of items. Try placing a pump on the [yellow]designated water[].";
} }
void onSwitch(){ void onSwitch(){
@@ -457,11 +456,12 @@ public class Tutorial{
blockPlaceX = 5; blockPlaceX = 5;
blockPlaceY = -2; blockPlaceY = -2;
blockRotation = 2; blockRotation = 2;
text = "Now place a conduit leading away from the pump."; text = "Now place a [orange]conduit[] leading away from the pump.";
} }
void onSwitch(){ void onSwitch(){
Vars.ui.<ImageButton>find("sectionbuttondistribution").fireClick(); Vars.ui.<ImageButton>find("sectionbuttondistribution").fireClick();
World.tile(blockPlaceX + World.core.x, blockPlaceY + World.core.y).setBlock(Blocks.air);
} }
}, },
conduitUse2{ conduitUse2{
@@ -473,9 +473,13 @@ public class Tutorial{
targetBlock = ProductionBlocks.conduit; targetBlock = ProductionBlocks.conduit;
blockPlaceX = 4; blockPlaceX = 4;
blockPlaceY = -2; blockPlaceY = -2;
blockRotation = 2; blockRotation = 1;
text = "And a few more..."; text = "And a few more...";
} }
void onSwitch(){
World.tile(blockPlaceX + World.core.x, blockPlaceY + World.core.y).setBlock(Blocks.air);
}
}, },
conduitUse3{ conduitUse3{
{ {
@@ -489,7 +493,61 @@ public class Tutorial{
blockRotation = 1; blockRotation = 1;
text = "And a few more..."; text = "And a few more...";
} }
}*/
void onSwitch(){
World.tile(blockPlaceX + World.core.x, blockPlaceY + World.core.y).setBlock(Blocks.air);
}
},
extractor{
{
canBack = false;
canForward = false;
showBlock = true;
canPlace = true;
targetBlock = ProductionBlocks.coalpurifier;
blockPlaceX = 4;
blockPlaceY = 0;
text = "Now, place a [orange]coal extractor[] block at the end of the conduit.";
}
void onSwitch(){
World.tile(blockPlaceX + World.core.x, blockPlaceY + World.core.y).setBlock(Blocks.air);
Vars.ui.<ImageButton>find("sectionbuttonproduction").fireClick();
Vars.control.addItem(Item.steel, 60);
Vars.control.addItem(Item.iron, 60);
}
},
extractorExplain{
{
canBack = false;
text = "The extractor will now produce [orange]coal[] from the stone and water, then move it to the core.";
}
void onSwitch(){
for(int i = -2; i <= 2; i ++){
World.tile(World.core.x + i + 4, World.core.y + 2).setBlock(ProductionBlocks.stonedrill);
World.tile(World.core.x + i + 4, World.core.y + 2).setFloor(Blocks.stone);
}
for(int i = 0; i < 3; i ++){
World.tile(World.core.x + 4 - 1 - i, World.core.y).setBlock(ProductionBlocks.conveyor, 2);
}
World.tile(World.core.x + 2, World.core.y + 1).setBlock(ProductionBlocks.conveyor, 0);
World.tile(World.core.x + 3, World.core.y + 1).setBlock(ProductionBlocks.conveyor, 0);
World.tile(World.core.x + 4, World.core.y + 1).setBlock(ProductionBlocks.conveyor, 3);
World.tile(World.core.x + 5, World.core.y + 1).setBlock(ProductionBlocks.conveyor, 2);
World.tile(World.core.x + 6, World.core.y + 1).setBlock(ProductionBlocks.conveyor, 2);
}
},
extractorMore{
{
canBack = false;
canPlace = true;
text = "The [orange]smeltery[] and [orange]crucible[] blocks work similarly to extractors, except they accept only items.";
}
},
end{ end{
{ {
text = "And that concludes the tutorial!"; text = "And that concludes the tutorial!";

View File

@@ -139,9 +139,9 @@ public class UI extends SceneModule{
prefs.screenshakePref(); prefs.screenshakePref();
prefs.volumePrefs(); prefs.volumePrefs();
prefs.checkPref("tutorial", "Show tutorial Window", true);
prefs.checkPref("fps", "Show FPS", false); prefs.checkPref("fps", "Show FPS", false);
prefs.checkPref("noshadows", "Disable shadows", false); prefs.checkPref("noshadows", "Disable shadows", false);
prefs.checkPref("smoothcam", "Smooth Camera", true);
prefs.hidden(()->{ prefs.hidden(()->{
if(!GameState.is(State.menu)){ if(!GameState.is(State.menu)){

View File

@@ -31,6 +31,9 @@ public class Vars{
//TODO named save slots, possibly with a scroll dialog //TODO named save slots, possibly with a scroll dialog
public static final int saveSlots = 4; public static final int saveSlots = 4;
//only if smoothCamera
public static boolean snapCamera = true;
//turret and enemy shoot speed inverse multiplier //turret and enemy shoot speed inverse multiplier
public static final float multiplier = android ? 3 : 2; public static final float multiplier = android ? 3 : 2;

View File

@@ -44,7 +44,12 @@ public class Player extends DestructibleEntity{
@Override @Override
public void draw(){ public void draw(){
if(Vars.snapCamera && Settings.getBool("smoothcam")){
Draw.rect("player", (int)x, (int)y, direction.angle()-90); Draw.rect("player", (int)x, (int)y, direction.angle()-90);
}else{
Draw.rect("player", x, y, direction.angle()-90);
}
} }
@Override @Override