Edited laser effect, fixed some bugs

This commit is contained in:
Anuken 2017-10-31 00:04:39 -04:00
parent 6d39ded754
commit 2e8f0a9d1a
10 changed files with 78 additions and 47 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 B

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 305 B

View File

@ -438,13 +438,20 @@ blocks/poweredconveyormove
orig: 8, 8
offset: 0, 0
index: -1
blocks/pump
blocks/powerlaser
rotate: false
xy: 489, 387
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/pump
rotate: false
xy: 499, 387
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/repairturret
rotate: false
xy: 177, 2
@ -454,35 +461,35 @@ blocks/repairturret
index: -1
blocks/rock
rotate: false
xy: 389, 224
xy: 389, 214
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/rock2
rotate: false
xy: 389, 214
xy: 389, 204
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/rock2shadow
rotate: false
xy: 389, 204
xy: 332, 197
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/rockshadow
rotate: false
xy: 332, 197
xy: 332, 187
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/router
rotate: false
xy: 332, 187
xy: 342, 197
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -496,7 +503,7 @@ blocks/shadow
index: -1
blocks/shieldgenerator
rotate: false
xy: 342, 197
xy: 332, 177
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -510,21 +517,21 @@ blocks/shotgunturret
index: -1
blocks/shrub
rotate: false
xy: 332, 177
xy: 342, 187
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/shrubshadow
rotate: false
xy: 342, 187
xy: 342, 177
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/smelter
rotate: false
xy: 342, 177
xy: 352, 192
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -538,21 +545,21 @@ blocks/sniperturret
index: -1
blocks/steelconveyor
rotate: false
xy: 352, 192
xy: 352, 182
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/steelconveyormove
rotate: false
xy: 352, 182
xy: 362, 192
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/steelwall
rotate: false
xy: 362, 192
xy: 362, 182
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -566,49 +573,49 @@ blocks/stone
index: -1
blocks/stone1
rotate: false
xy: 362, 182
xy: 372, 192
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/stone2
rotate: false
xy: 372, 192
xy: 372, 182
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/stone3
rotate: false
xy: 372, 182
xy: 382, 192
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/stoneblock
rotate: false
xy: 382, 192
xy: 382, 182
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/stoneblock2
rotate: false
xy: 382, 182
xy: 352, 172
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/stoneblock3
rotate: false
xy: 352, 172
xy: 362, 172
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/stonedrill
rotate: false
xy: 362, 172
xy: 372, 172
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -622,63 +629,63 @@ blocks/stoneedge
index: -1
blocks/stonewall
rotate: false
xy: 372, 172
xy: 382, 172
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/thermalgenerator
rotate: false
xy: 382, 172
xy: 392, 194
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/titanium1
rotate: false
xy: 392, 194
xy: 392, 184
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/titanium2
rotate: false
xy: 392, 184
xy: 392, 174
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/titanium3
rotate: false
xy: 392, 174
xy: 332, 167
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/titaniumdrill
rotate: false
xy: 332, 167
xy: 342, 167
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/titaniumpurifier
rotate: false
xy: 342, 167
xy: 352, 162
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/titaniumshieldwall
rotate: false
xy: 352, 162
xy: 362, 162
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/titaniumwall
rotate: false
xy: 362, 162
xy: 372, 162
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -692,35 +699,35 @@ blocks/turret
index: -1
blocks/uranium1
rotate: false
xy: 382, 162
xy: 392, 164
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/uranium2
rotate: false
xy: 392, 164
xy: 389, 282
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/uranium3
rotate: false
xy: 389, 282
xy: 389, 272
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/uraniumdrill
rotate: false
xy: 389, 272
xy: 389, 262
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/water
rotate: false
xy: 389, 262
xy: 389, 252
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1374,14 +1381,14 @@ weapons/multigun
index: -1
weapons/railgun
rotate: false
xy: 499, 387
xy: 389, 224
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
weapons/triblaster
rotate: false
xy: 372, 162
xy: 382, 162
size: 8, 8
orig: 8, 8
offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -58,6 +58,7 @@ public enum Recipe{
combustiongenerator(power, ProductionBlocks.combustiongenerator, stack(Item.titanium, 10), stack(Item.dirium, 10)),
nuclearreactor(power, ProductionBlocks.nuclearReactor, stack(Item.titanium, 10), stack(Item.dirium, 10)),
powerbooster(power, DistributionBlocks.powerbooster, stack(Item.titanium, 10), stack(Item.dirium, 10)),
powerlaser(power, DistributionBlocks.powerlaser, stack(Item.titanium, 10), stack(Item.dirium, 10)),
pump(production, ProductionBlocks.pump, stack(Item.steel, 10));

View File

@ -16,6 +16,7 @@ import io.anuke.ucore.scene.ui.*;
import io.anuke.ucore.scene.ui.layout.Table;
public class UpgradeDialog extends Dialog{
boolean wasPaused = false;
public UpgradeDialog() {
super("Upgrades");
@ -26,9 +27,11 @@ public class UpgradeDialog extends Dialog{
addCloseButton();
hidden(()->{
GameState.set(State.playing);
if(!wasPaused)
GameState.set(State.playing);
});
shown(()->{
wasPaused = GameState.is(State.paused);
GameState.set(State.paused);
});
@ -37,7 +40,6 @@ public class UpgradeDialog extends Dialog{
}).size(96, 50).pad(5);
Table weptab = new Table();
//weptab.background("button");
weptab.pad(20);
int i = 0;

View File

@ -46,5 +46,10 @@ public class DistributionBlocks{
{
formalName = "power booster";
}
},
powerlaser = new PowerLaser("powerlaser"){
{
formalName = "power laser";
}
};
}

View File

@ -1,35 +1,49 @@
package io.anuke.mindustry.world.blocks.types.distribution;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.GridPoint2;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.World;
import io.anuke.mindustry.world.blocks.types.PowerAcceptor;
import io.anuke.mindustry.world.blocks.types.PowerBlock;
import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Geometry;
import io.anuke.ucore.util.Mathf;
public class PowerLaser extends PowerBlock{
public int laserRange = 4;
public float powerAmount = 0.01f;
public int laserRange = 6;
public float powerAmount = 0.03f;
public Color color = Color.valueOf("e54135");
public PowerLaser(String name) {
super(name);
rotate = true;
solid = true;
}
@Override
public void drawOver(Tile tile){
Tile target = target(tile);
if(target != null){
Draw.laser("laser", "laserend", tile.worldx(), tile.worldy(), target.worldx(), target.worldy());
}else{
Angles.translation(tile.rotation*90, laserRange*Vars.tilesize);
PowerEntity entity = tile.entity();
if(target != null && entity.power > powerAmount){
Angles.translation(tile.rotation * 90, 6f);
Draw.laser("laser", "laserend", tile.worldx(), tile.worldy(), tile.worldx() + Angles.x(), tile.worldy() + Angles.y());
Draw.color(Color.GRAY, Color.WHITE, 0.902f + Mathf.sin(Timers.time(), 1.7f, 0.08f));
Draw.alpha(1f);
float r = 0f;
Draw.laser("laser", "laserend",
tile.worldx() + Angles.x() + Mathf.range(r), tile.worldy() + Angles.y() + Mathf.range(r),
target.worldx() - Angles.x() + Mathf.range(r), target.worldy() - Angles.y() + Mathf.range(r),
0.7f + Mathf.sin(Timers.time(), 2f, 0.1f*0));
Draw.color();
}
}
@ -38,6 +52,8 @@ public class PowerLaser extends PowerBlock{
PowerEntity entity = tile.entity();
Tile target = target(tile);
if(target == null) return;
PowerAcceptor p = (PowerAcceptor)target.block();
if(p.acceptsPower(target) && entity.power >= powerAmount){
entity.power -= (powerAmount - p.addPower(target, powerAmount));

View File

@ -14,7 +14,7 @@ import io.anuke.ucore.util.Mathf;
public class Generator extends PowerBlock{
public static final int powerTime = 2;
public int powerRange = 6;
public int powerRange = 4;
public float powerSpeed = 0.2f;
public Generator(String name) {