Implemented GFX for all status effects
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Thu Apr 05 21:32:39 EDT 2018
|
#Thu Apr 05 22:24:14 EDT 2018
|
||||||
version=release
|
version=release
|
||||||
androidBuildCode=851
|
androidBuildCode=851
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package io.anuke.mindustry.content;
|
package io.anuke.mindustry.content;
|
||||||
|
|
||||||
|
import io.anuke.mindustry.content.fx.EnvironmentFx;
|
||||||
import io.anuke.mindustry.entities.StatusController.TransitionResult;
|
import io.anuke.mindustry.entities.StatusController.TransitionResult;
|
||||||
import io.anuke.mindustry.entities.StatusEffect;
|
import io.anuke.mindustry.entities.StatusEffect;
|
||||||
import io.anuke.mindustry.entities.Unit;
|
import io.anuke.mindustry.entities.Unit;
|
||||||
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class StatusEffects {
|
public class StatusEffects {
|
||||||
public static final StatusEffect
|
public static final StatusEffect
|
||||||
@@ -18,6 +21,8 @@ public class StatusEffects {
|
|||||||
@Override
|
@Override
|
||||||
public TransitionResult getTransition(Unit unit, StatusEffect to, float time, float newTime, TransitionResult result){
|
public TransitionResult getTransition(Unit unit, StatusEffect to, float time, float newTime, TransitionResult result){
|
||||||
if(to == oiled){
|
if(to == oiled){
|
||||||
|
unit.damage(1f, false);
|
||||||
|
Effects.effect(EnvironmentFx.burning, unit.x + Mathf.range(unit.getSize()/2f), unit.y + Mathf.range(unit.getSize()/2f));
|
||||||
return result.set(this, Math.min(time + newTime, baseDuration + oiled.baseDuration));
|
return result.set(this, Math.min(time + newTime, baseDuration + oiled.baseDuration));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +31,12 @@ public class StatusEffects {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Unit unit, float time){
|
public void update(Unit unit, float time){
|
||||||
unit.damage(0.04f * Timers.delta());
|
unit.damage(0.04f * Timers.delta(), false);
|
||||||
|
|
||||||
|
if(Mathf.chance(Timers.delta() * 0.2f)){
|
||||||
|
Effects.effect(EnvironmentFx.burning, unit.x + Mathf.range(unit.getSize()/2f), unit.y + Mathf.range(unit.getSize()/2f));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -37,7 +47,11 @@ public class StatusEffects {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Unit unit, float time){
|
public void update(Unit unit, float time){
|
||||||
unit.velocity.scl(0.6f);
|
unit.velocity.scl(0.7f);
|
||||||
|
|
||||||
|
if(Mathf.chance(Timers.delta() * 0.15f)){
|
||||||
|
Effects.effect(EnvironmentFx.freezing, unit.x + Mathf.range(unit.getSize()/2f), unit.y + Mathf.range(unit.getSize()/2f));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -48,6 +62,10 @@ public class StatusEffects {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Unit unit, float time){
|
public void update(Unit unit, float time){
|
||||||
|
if(Mathf.chance(Timers.delta() * 0.15f)){
|
||||||
|
Effects.effect(EnvironmentFx.wet, unit.x + Mathf.range(unit.getSize()/2f), unit.y + Mathf.range(unit.getSize()/2f));
|
||||||
|
}
|
||||||
|
|
||||||
unit.velocity.scl(0.999f);
|
unit.velocity.scl(0.999f);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -69,13 +87,21 @@ public class StatusEffects {
|
|||||||
@Override
|
@Override
|
||||||
public void update(Unit unit, float time){
|
public void update(Unit unit, float time){
|
||||||
unit.velocity.scl(0.8f);
|
unit.velocity.scl(0.8f);
|
||||||
unit.damage(0.1f * Timers.delta());
|
unit.damage(0.1f * Timers.delta(), false);
|
||||||
|
|
||||||
|
if(Mathf.chance(Timers.delta() * 0.2f)){
|
||||||
|
Effects.effect(EnvironmentFx.melting, unit.x + Mathf.range(unit.getSize()/2f), unit.y + Mathf.range(unit.getSize()/2f));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
oiled = new StatusEffect(4*60f){
|
oiled = new StatusEffect(4*60f){
|
||||||
@Override
|
@Override
|
||||||
public void update(Unit unit, float time){
|
public void update(Unit unit, float time){
|
||||||
|
if(Mathf.chance(Timers.delta() * 0.15f)){
|
||||||
|
Effects.effect(EnvironmentFx.oily, unit.x + Mathf.range(unit.getSize()/2f), unit.y + Mathf.range(unit.getSize()/2f));
|
||||||
|
}
|
||||||
|
|
||||||
unit.velocity.scl(1.001f);
|
unit.velocity.scl(1.001f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ public class TurretBullets {
|
|||||||
drag = 0.07f;
|
drag = 0.07f;
|
||||||
hiteffect = BulletFx.hitFlameSmall;
|
hiteffect = BulletFx.hitFlameSmall;
|
||||||
despawneffect = Fx.none;
|
despawneffect = Fx.none;
|
||||||
|
status = StatusEffects.burning;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -142,6 +143,7 @@ public class TurretBullets {
|
|||||||
{
|
{
|
||||||
status = StatusEffects.wet;
|
status = StatusEffects.wet;
|
||||||
statusIntensity = 0.5f;
|
statusIntensity = 0.5f;
|
||||||
|
knockback = 0.65f;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cryoShot = new LiquidShot(Liquids.cryofluid) {
|
cryoShot = new LiquidShot(Liquids.cryofluid) {
|
||||||
@@ -187,7 +189,7 @@ public class TurretBullets {
|
|||||||
despawneffect = Fx.none;
|
despawneffect = Fx.none;
|
||||||
hiteffect = BulletFx.hitLiquid;
|
hiteffect = BulletFx.hitLiquid;
|
||||||
drag = 0.01f;
|
drag = 0.01f;
|
||||||
knockback = 0.65f;
|
knockback = 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.content.fx;
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Colors;
|
import com.badlogic.gdx.graphics.Colors;
|
||||||
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
import io.anuke.ucore.core.Effects.Effect;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Fill;
|
import io.anuke.ucore.graphics.Fill;
|
||||||
@@ -71,35 +72,35 @@ public class BlockFx {
|
|||||||
}),
|
}),
|
||||||
pulverize = new Effect(40, e -> {
|
pulverize = new Effect(40, e -> {
|
||||||
Angles.randLenVectors(e.id, 5, 3f + e.fin()*8f, (x, y)->{
|
Angles.randLenVectors(e.id, 5, 3f + e.fin()*8f, (x, y)->{
|
||||||
Draw.color(Fx.stoneGray);
|
Draw.color(Palette.stoneGray);
|
||||||
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2f + 0.5f, 45);
|
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2f + 0.5f, 45);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
pulverizeRed = new Effect(40, e -> {
|
pulverizeRed = new Effect(40, e -> {
|
||||||
Angles.randLenVectors(e.id, 5, 3f + e.fin()*8f, (x, y)->{
|
Angles.randLenVectors(e.id, 5, 3f + e.fin()*8f, (x, y)->{
|
||||||
Draw.color(Color.valueOf("ffa480"), Fx.stoneGray, e.fin());
|
Draw.color(Color.valueOf("ffa480"), Palette.stoneGray, e.fin());
|
||||||
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2f + 0.5f, 45);
|
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2f + 0.5f, 45);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
pulverizeRedder = new Effect(40, e -> {
|
pulverizeRedder = new Effect(40, e -> {
|
||||||
Angles.randLenVectors(e.id, 5, 3f + e.fin()*9f, (x, y)->{
|
Angles.randLenVectors(e.id, 5, 3f + e.fin()*9f, (x, y)->{
|
||||||
Draw.color(Color.valueOf("ff7b69"), Fx.stoneGray, e.fin());
|
Draw.color(Color.valueOf("ff7b69"), Palette.stoneGray, e.fin());
|
||||||
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2.5f + 0.5f, 45);
|
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2.5f + 0.5f, 45);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
pulverizeSmall = new Effect(30, e -> {
|
pulverizeSmall = new Effect(30, e -> {
|
||||||
Angles.randLenVectors(e.id, 3, e.fin()*5f, (x, y)->{
|
Angles.randLenVectors(e.id, 3, e.fin()*5f, (x, y)->{
|
||||||
Draw.color(Fx.stoneGray);
|
Draw.color(Palette.stoneGray);
|
||||||
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 1f + 0.5f, 45);
|
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 1f + 0.5f, 45);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
pulverizeMedium = new Effect(30, e -> {
|
pulverizeMedium = new Effect(30, e -> {
|
||||||
Angles.randLenVectors(e.id, 5, 3f + e.fin()*8f, (x, y)->{
|
Angles.randLenVectors(e.id, 5, 3f + e.fin()*8f, (x, y)->{
|
||||||
Draw.color(Fx.stoneGray);
|
Draw.color(Palette.stoneGray);
|
||||||
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 1f + 0.5f, 45);
|
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 1f + 0.5f, 45);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
|
|||||||
65
core/src/io/anuke/mindustry/content/fx/EnvironmentFx.java
Normal file
65
core/src/io/anuke/mindustry/content/fx/EnvironmentFx.java
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
package io.anuke.mindustry.content.fx;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
import io.anuke.mindustry.content.Liquids;
|
||||||
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
|
import io.anuke.ucore.core.Effects.Effect;
|
||||||
|
import io.anuke.ucore.graphics.Draw;
|
||||||
|
import io.anuke.ucore.graphics.Fill;
|
||||||
|
import io.anuke.ucore.util.Angles;
|
||||||
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
|
public class EnvironmentFx {
|
||||||
|
|
||||||
|
public static final Effect
|
||||||
|
|
||||||
|
burning = new Effect(35f, e -> {
|
||||||
|
Draw.color(Palette.lightFlame, Palette.darkFlame, e.fin());
|
||||||
|
|
||||||
|
Angles.randLenVectors(e.id, 3, 2f + e.fin()*7f, (x, y) -> {
|
||||||
|
Fill.circle(e.x + x, e.y + y, 0.1f + e.fout() * 1.4f);
|
||||||
|
});
|
||||||
|
|
||||||
|
Draw.color();
|
||||||
|
}),
|
||||||
|
|
||||||
|
freezing = new Effect(40f, e -> {
|
||||||
|
Draw.color(Liquids.cryofluid.color);
|
||||||
|
|
||||||
|
Angles.randLenVectors(e.id, 2, 1f + e.fin()*2f, (x, y) -> {
|
||||||
|
Fill.circle(e.x + x, e.y + y, e.fout() * 1.2f);
|
||||||
|
});
|
||||||
|
|
||||||
|
Draw.color();
|
||||||
|
}),
|
||||||
|
|
||||||
|
melting = new Effect(40f, e -> {
|
||||||
|
Draw.color(Liquids.lava.color, Color.WHITE, e.fout()/5f + Mathf.randomSeedRange(e.id, 0.12f));
|
||||||
|
|
||||||
|
Angles.randLenVectors(e.id, 2, 1f + e.fin()*3f, (x, y) -> {
|
||||||
|
Fill.circle(e.x + x, e.y + y, .2f + e.fout() * 1.2f);
|
||||||
|
});
|
||||||
|
|
||||||
|
Draw.color();
|
||||||
|
}),
|
||||||
|
|
||||||
|
wet = new Effect(40f, e -> {
|
||||||
|
Draw.color(Liquids.water.color);
|
||||||
|
|
||||||
|
Angles.randLenVectors(e.id, 2, 1f + e.fin()*2f, (x, y) -> {
|
||||||
|
Fill.circle(e.x + x, e.y + y, e.fout() * 1f);
|
||||||
|
});
|
||||||
|
|
||||||
|
Draw.color();
|
||||||
|
}),
|
||||||
|
|
||||||
|
oily = new Effect(42f, e -> {
|
||||||
|
Draw.color(Liquids.oil.color);
|
||||||
|
|
||||||
|
Angles.randLenVectors(e.id, 2, 1f + e.fin()*2f, (x, y) -> {
|
||||||
|
Fill.circle(e.x + x, e.y + y, e.fout() * 1f);
|
||||||
|
});
|
||||||
|
|
||||||
|
Draw.color();
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -12,15 +12,6 @@ import io.anuke.ucore.util.Mathf;
|
|||||||
public class ExplosionFx {
|
public class ExplosionFx {
|
||||||
public static final Effect
|
public static final Effect
|
||||||
|
|
||||||
generatorexplosion = new Effect(28, 40f, e -> {
|
|
||||||
Angles.randLenVectors(e.id, 16, 10f + e.fin()*8f, (x, y) -> {
|
|
||||||
float size = e.fout()*12f + 1f;
|
|
||||||
Draw.color(Color.WHITE, Color.PURPLE, e.fin());
|
|
||||||
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
|
||||||
Draw.reset();
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
|
|
||||||
shockwave = new Effect(10f, 80f, e -> {
|
shockwave = new Effect(10f, 80f, e -> {
|
||||||
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
|
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
|
||||||
Lines.stroke(e.fout()*2f + 0.2f);
|
Lines.stroke(e.fout()*2f + 0.2f);
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ import static io.anuke.mindustry.Vars.respawnduration;
|
|||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
|
|
||||||
public class Fx{
|
public class Fx{
|
||||||
public static Color beam = Color.valueOf("9bffbe");
|
|
||||||
public static Color stoneGray = Color.valueOf("8f8f8f");
|
|
||||||
|
|
||||||
public static final Effect
|
public static final Effect
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,11 @@ public class Player extends Unit{
|
|||||||
return mech.flying;
|
return mech.flying;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getSize() {
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void damage(float amount){
|
public void damage(float amount){
|
||||||
if(debug || mech.flying) return;
|
if(debug || mech.flying) return;
|
||||||
|
|||||||
@@ -19,21 +19,23 @@ public class StatusController {
|
|||||||
}else {
|
}else {
|
||||||
|
|
||||||
current.getTransition(unit, effect, time, newTime, globalResult);
|
current.getTransition(unit, effect, time, newTime, globalResult);
|
||||||
|
time = globalResult.time;
|
||||||
|
|
||||||
if (globalResult.result != current) {
|
if (globalResult.result != current) {
|
||||||
current.onTransition(unit, globalResult.result);
|
current.onTransition(unit, globalResult.result);
|
||||||
time = globalResult.time;
|
|
||||||
current = globalResult.result;
|
current = globalResult.result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(Unit unit){
|
public void update(Unit unit){
|
||||||
if(time > 0){
|
time = Math.max(time - Timers.delta(), 0);
|
||||||
time = Math.max(time - Timers.delta(), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
current.update(unit, time);
|
if(time <= 0){
|
||||||
|
current = StatusEffects.none;
|
||||||
|
}else{
|
||||||
|
current.update(unit, time);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(StatusEffect current, float time){
|
public void set(StatusEffect current, float time){
|
||||||
|
|||||||
@@ -12,6 +12,21 @@ public abstract class Unit extends SyncEntity {
|
|||||||
public Vector2 velocity = new Vector2();
|
public Vector2 velocity = new Vector2();
|
||||||
public float hitTime;
|
public float hitTime;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void damage(float amount){
|
||||||
|
super.damage(amount);
|
||||||
|
hitTime = hitDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void damage(float amount, boolean withEffect){
|
||||||
|
if(withEffect){
|
||||||
|
damage(amount);
|
||||||
|
}else{
|
||||||
|
super.damage(amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public abstract float getMass();
|
public abstract float getMass();
|
||||||
public abstract boolean isFlying();
|
public abstract boolean isFlying();
|
||||||
|
public abstract float getSize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,12 @@ public class BaseUnit extends Unit {
|
|||||||
rotation = Mathf.slerpDelta(rotation, angle, type.rotatespeed);
|
rotation = Mathf.slerpDelta(rotation, angle, type.rotatespeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO
|
||||||
|
@Override
|
||||||
|
public float getSize() {
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void move(float x, float y){
|
public void move(float x, float y){
|
||||||
baseRotation = Mathf.slerpDelta(baseRotation, Mathf.atan2(x, y), type.baseRotateSpeed);
|
baseRotation = Mathf.slerpDelta(baseRotation, Mathf.atan2(x, y), type.baseRotateSpeed);
|
||||||
@@ -73,12 +79,6 @@ public class BaseUnit extends Unit {
|
|||||||
return other instanceof Bullet && state.teams.areEnemies((((Bullet) other).team), team);
|
return other instanceof Bullet && state.teams.areEnemies((((Bullet) other).team), team);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void damage(float amount){
|
|
||||||
super.damage(amount);
|
|
||||||
hitTime = hitDuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemoteShoot(BulletType type, float x, float y, float rotation, short data) {
|
public void onRemoteShoot(BulletType type, float x, float y, float rotation, short data) {
|
||||||
new Bullet(type, this, x, y, rotation).add().damage = data;
|
new Bullet(type, this, x, y, rotation).add().damage = data;
|
||||||
|
|||||||
@@ -17,4 +17,6 @@ public class Palette {
|
|||||||
public static final Color lightishGray = Color.valueOf("a2a2a2");
|
public static final Color lightishGray = Color.valueOf("a2a2a2");
|
||||||
|
|
||||||
public static final Color lancerLaser = Color.valueOf("a9d8ff");
|
public static final Color lancerLaser = Color.valueOf("a9d8ff");
|
||||||
|
|
||||||
|
public static final Color stoneGray = Color.valueOf("8f8f8f");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.utils.TimeUtils;
|
|||||||
import io.anuke.mindustry.content.Weapons;
|
import io.anuke.mindustry.content.Weapons;
|
||||||
import io.anuke.mindustry.content.blocks.Blocks;
|
import io.anuke.mindustry.content.blocks.Blocks;
|
||||||
import io.anuke.mindustry.content.blocks.StorageBlocks;
|
import io.anuke.mindustry.content.blocks.StorageBlocks;
|
||||||
|
import io.anuke.mindustry.entities.StatusEffect;
|
||||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||||
import io.anuke.mindustry.entities.units.UnitType;
|
import io.anuke.mindustry.entities.units.UnitType;
|
||||||
import io.anuke.mindustry.game.Difficulty;
|
import io.anuke.mindustry.game.Difficulty;
|
||||||
@@ -66,11 +67,14 @@ public class Save16 extends SaveFileVersion {
|
|||||||
float playerx = stream.readFloat();
|
float playerx = stream.readFloat();
|
||||||
float playery = stream.readFloat();
|
float playery = stream.readFloat();
|
||||||
|
|
||||||
int playerhealth = stream.readInt();
|
short playerhealth = stream.readShort();
|
||||||
|
byte peffect = stream.readByte();
|
||||||
|
float petime = stream.readFloat();
|
||||||
|
|
||||||
if(!headless) {
|
if(!headless) {
|
||||||
player.x = playerx;
|
player.x = playerx;
|
||||||
player.y = playery;
|
player.y = playery;
|
||||||
|
player.status.set(StatusEffect.getByID(peffect), petime);
|
||||||
player.health = playerhealth;
|
player.health = playerhealth;
|
||||||
state.mode = GameMode.values()[mode];
|
state.mode = GameMode.values()[mode];
|
||||||
Core.camera.position.set(playerx, playery, 0);
|
Core.camera.position.set(playerx, playery, 0);
|
||||||
@@ -121,11 +125,14 @@ public class Save16 extends SaveFileVersion {
|
|||||||
float x = stream.readFloat();
|
float x = stream.readFloat();
|
||||||
float y = stream.readFloat();
|
float y = stream.readFloat();
|
||||||
int health = stream.readShort();
|
int health = stream.readShort();
|
||||||
|
byte effect = stream.readByte();
|
||||||
|
float etime = stream.readFloat();
|
||||||
|
|
||||||
BaseUnit enemy = new BaseUnit(UnitType.getByID(type), team);
|
BaseUnit enemy = new BaseUnit(UnitType.getByID(type), team);
|
||||||
enemy.health = health;
|
enemy.health = health;
|
||||||
enemy.x = x;
|
enemy.x = x;
|
||||||
enemy.y = y;
|
enemy.y = y;
|
||||||
|
enemy.status.set(StatusEffect.getByID(effect), etime);
|
||||||
enemy.add(group);
|
enemy.add(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -220,6 +227,9 @@ public class Save16 extends SaveFileVersion {
|
|||||||
|
|
||||||
stream.writeShort((short)player.health); //player health
|
stream.writeShort((short)player.health); //player health
|
||||||
|
|
||||||
|
stream.writeByte(player.status.current().id); //status effect info
|
||||||
|
stream.writeFloat(player.status.getTime());
|
||||||
|
|
||||||
stream.writeByte(control.upgrades().getWeapons().size - 1); //amount of weapons
|
stream.writeByte(control.upgrades().getWeapons().size - 1); //amount of weapons
|
||||||
|
|
||||||
//start at 1, because the first weapon is always the starter - ignore that
|
//start at 1, because the first weapon is always the starter - ignore that
|
||||||
@@ -265,6 +275,8 @@ public class Save16 extends SaveFileVersion {
|
|||||||
stream.writeFloat(unit.x); //x
|
stream.writeFloat(unit.x); //x
|
||||||
stream.writeFloat(unit.y); //y
|
stream.writeFloat(unit.y); //y
|
||||||
stream.writeShort((short)unit.health); //health
|
stream.writeShort((short)unit.health); //health
|
||||||
|
stream.writeByte(unit.status.current().id);
|
||||||
|
stream.writeFloat(unit.status.getTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class Block extends BaseBlock {
|
|||||||
/**display name*/
|
/**display name*/
|
||||||
public final String formalName;
|
public final String formalName;
|
||||||
/**played on destroy*/
|
/**played on destroy*/
|
||||||
public Effect explosionEffect = ExplosionFx.generatorexplosion;
|
public Effect explosionEffect = ExplosionFx.explosion; //TODO better explosion effect
|
||||||
/**played on destroy*/
|
/**played on destroy*/
|
||||||
public String explosionSound = "break";
|
public String explosionSound = "break";
|
||||||
/**whether this block has a tile entity that updates*/
|
/**whether this block has a tile entity that updates*/
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
package io.anuke.mindustry.world.blocks.types.power;
|
package io.anuke.mindustry.world.blocks.types.power;
|
||||||
|
|
||||||
import com.badlogic.gdx.math.GridPoint2;
|
import com.badlogic.gdx.math.GridPoint2;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
|
||||||
import io.anuke.mindustry.content.fx.BlockFx;
|
import io.anuke.mindustry.content.fx.BlockFx;
|
||||||
import io.anuke.mindustry.content.fx.ExplosionFx;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.world.Edges;
|
import io.anuke.mindustry.world.Edges;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.types.PowerBlock;
|
import io.anuke.mindustry.world.blocks.types.PowerBlock;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.util.Mathf;
|
|
||||||
|
|
||||||
public class PowerGenerator extends PowerBlock {
|
public class PowerGenerator extends PowerBlock {
|
||||||
|
|
||||||
@@ -63,16 +61,7 @@ public class PowerGenerator extends PowerBlock {
|
|||||||
float x = tile.worldx(), y = tile.worldy();
|
float x = tile.worldx(), y = tile.worldy();
|
||||||
|
|
||||||
Effects.effect(BlockFx.blastsmoke, x, y);
|
Effects.effect(BlockFx.blastsmoke, x, y);
|
||||||
|
//TODO better effect
|
||||||
Timers.run(Mathf.random(8f + Mathf.random(6f)), () -> {
|
|
||||||
Effects.shake(6f, 8f, x, y);
|
|
||||||
Effects.effect(ExplosionFx.generatorexplosion, x, y);
|
|
||||||
Effects.effect(ExplosionFx.shockwave, x, y);
|
|
||||||
|
|
||||||
//TODO better explosion effect!
|
|
||||||
|
|
||||||
Effects.sound(explosionSound, x, y);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user