Added unit death scorch effects, more bugfixes
This commit is contained in:
@@ -10,6 +10,7 @@ import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.effect.ItemDrop;
|
||||
import io.anuke.mindustry.entities.effect.ScorchDecal;
|
||||
import io.anuke.mindustry.entities.traits.BuilderTrait;
|
||||
import io.anuke.mindustry.entities.traits.CarriableTrait;
|
||||
import io.anuke.mindustry.entities.traits.CarryTrait;
|
||||
@@ -222,6 +223,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
|
||||
float explosiveness = 2f + (player.inventory.hasItem() ? player.inventory.getItem().item.explosiveness * player.inventory.getItem().amount : 0f);
|
||||
float flammability = (player.inventory.hasItem() ? player.inventory.getItem().item.flammability * player.inventory.getItem().amount : 0f);
|
||||
Damage.dynamicExplosion(player.x, player.y, flammability, explosiveness, 0f, player.getSize()/2f, Palette.darkFlame);
|
||||
ScorchDecal.create(player.x, player.y);
|
||||
Effects.sound("die", player);
|
||||
player.onDeath();
|
||||
}
|
||||
|
||||
@@ -11,17 +11,8 @@ import io.anuke.ucore.util.Mathf;
|
||||
import static io.anuke.mindustry.Vars.groundEffectGroup;
|
||||
|
||||
/**Class for creating block rubble on the ground.*/
|
||||
public class Rubble extends TimedEntity implements BelowLiquidTrait, DrawTrait {
|
||||
public abstract class Decal extends TimedEntity implements BelowLiquidTrait, DrawTrait {
|
||||
private static final Color color = Color.valueOf("52504e");
|
||||
private int size;
|
||||
|
||||
/**Creates a rubble effect at a position. Provide a block size to use.*/
|
||||
public static void create(float x, float y, int size){
|
||||
Rubble rubble = new Rubble();
|
||||
rubble.size = size;
|
||||
rubble.set(x, y);
|
||||
rubble.add();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float lifetime() {
|
||||
@@ -30,15 +21,8 @@ public class Rubble extends TimedEntity implements BelowLiquidTrait, DrawTrait {
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
String region = "rubble-" + size + "-" + Mathf.randomSeed(id, 0, 1);
|
||||
|
||||
if(!Draw.hasRegion(region)){
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
|
||||
Draw.color(color.r, color.g, color.b, 1f-Mathf.curve(fin(), 0.98f));
|
||||
Draw.rect(region, x, y, Mathf.randomSeed(id, 0, 4) * 90);
|
||||
drawDecal();
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
@@ -46,4 +30,6 @@ public class Rubble extends TimedEntity implements BelowLiquidTrait, DrawTrait {
|
||||
public EntityGroup targetGroup() {
|
||||
return groundEffectGroup;
|
||||
}
|
||||
|
||||
abstract void drawDecal();
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawT
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
float size = itemSize * (1f - sinktime/sinkLifetime);
|
||||
float size = itemSize * (1f - sinktime/sinkLifetime) * (1f-Mathf.curve(fin(), 0.98f));
|
||||
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
|
||||
|
||||
28
core/src/io/anuke/mindustry/entities/effect/RubbleDecal.java
Normal file
28
core/src/io/anuke/mindustry/entities/effect/RubbleDecal.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package io.anuke.mindustry.entities.effect;
|
||||
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class RubbleDecal extends Decal {
|
||||
private int size;
|
||||
|
||||
/**Creates a rubble effect at a position. Provide a block size to use.*/
|
||||
public static void create(float x, float y, int size){
|
||||
RubbleDecal decal = new RubbleDecal();
|
||||
decal.size = size;
|
||||
decal.set(x, y);
|
||||
decal.add();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawDecal(){
|
||||
String region = "rubble-" + size + "-" + Mathf.randomSeed(id, 0, 1);
|
||||
|
||||
if(!Draw.hasRegion(region)){
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
|
||||
Draw.rect(region, x, y, Mathf.randomSeed(id, 0, 4) * 90);
|
||||
}
|
||||
}
|
||||
41
core/src/io/anuke/mindustry/entities/effect/ScorchDecal.java
Normal file
41
core/src/io/anuke/mindustry/entities/effect/ScorchDecal.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package io.anuke.mindustry.entities.effect;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class ScorchDecal extends Decal {
|
||||
private static final int scorches = 5;
|
||||
private static final TextureRegion[] regions = new TextureRegion[scorches];
|
||||
|
||||
public static void create(float x, float y){
|
||||
if(regions[0] == null){
|
||||
for (int i = 0; i < regions.length; i++) {
|
||||
regions[i] = Draw.region("scorch" + (i+1));
|
||||
}
|
||||
}
|
||||
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
|
||||
if(tile == null || tile.floor().liquidDrop != null) return;
|
||||
|
||||
ScorchDecal decal = new ScorchDecal();
|
||||
decal.set(x, y);
|
||||
decal.add();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawDecal(){
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
TextureRegion region = regions[Mathf.randomSeed(id - i, 0, scorches-1)];
|
||||
float rotation = Mathf.randomSeed(id + i, 0, 360);
|
||||
float space = 1.5f + Mathf.randomSeed(id + i + 1, 0, 20)/10f;
|
||||
Draw.grect(region, x + Angles.trnsx(rotation, space), y + Angles.trnsy(rotation, space), rotation - 90);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.entities.bullet.Bullet;
|
||||
import io.anuke.mindustry.entities.effect.ScorchDecal;
|
||||
import io.anuke.mindustry.entities.traits.TargetTrait;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.gen.CallEntity;
|
||||
@@ -319,6 +320,7 @@ public abstract class BaseUnit extends Unit{
|
||||
unit.onSuperDeath();
|
||||
UnitDrops.dropItems(unit);
|
||||
|
||||
ScorchDecal.create(unit.x, unit.y);
|
||||
Effects.effect(ExplosionFx.explosion, unit);
|
||||
Effects.shake(2f, 2f, unit);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user