Added (mobile) pickup/dropping of units

This commit is contained in:
Anuken
2018-06-05 00:02:07 -04:00
parent b10fa9e5b2
commit c5ed0afb4e
14 changed files with 148 additions and 44 deletions

View File

@@ -12,7 +12,7 @@ import io.anuke.ucore.util.Angles;
import static io.anuke.mindustry.Vars.tilesize;
public class Fx implements ContentList {
public static Effect none, placeBlock, breakBlock, smoke, spawn, tapBlock;
public static Effect none, placeBlock, breakBlock, smoke, spawn, tapBlock, select;
@Override
public void load() {
@@ -45,6 +45,13 @@ public class Fx implements ContentList {
Draw.reset();
});
select = new Effect(23, e -> {
Draw.color(Palette.accent);
Lines.stroke(e.fout() * 3f);
Lines.circle(e.x, e.y, 3f + e.fin() * 14f);
Draw.reset();
});
smoke = new Effect(100, e -> {
Draw.color(Color.GRAY, new Color(0.3f, 0.3f, 0.3f, 1f), e.fin());
float size = 7f - e.fin() * 7f;

View File

@@ -1,15 +1,17 @@
package io.anuke.mindustry.content.fx;
import io.anuke.mindustry.entities.effect.GroundEffectEntity.GroundEffect;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.type.ContentList;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Fill;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
public class UnitFx implements ContentList {
public static Effect vtolHover;
public static Effect vtolHover, unitDrop, unitPickup;
@Override
public void load() {
@@ -21,5 +23,20 @@ public class UnitFx implements ContentList {
Fill.circle(e.x + Angles.trnsx(ang, len), e.y + Angles.trnsy(ang, len), 2f * e.fout());
Draw.reset();
});
unitDrop = new GroundEffect(30, e -> {
Draw.color(Palette.lightishGray);
Angles.randLenVectors(e.id, 9, 3 + 20f * e.finpow(), (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 4f + 0.4f);
});
Draw.reset();
});
unitPickup = new GroundEffect(18, e -> {
Draw.color(Palette.lightishGray);
Lines.stroke(e.fin() * 2f);
Lines.poly(e.x, e.y, 4, 13f * e.fout());
Draw.reset();
});
}
}