Implemented item dumping
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Sat Apr 14 11:58:08 EDT 2018
|
#Sat Apr 14 13:47:10 EDT 2018
|
||||||
version=release
|
version=release
|
||||||
androidBuildCode=918
|
androidBuildCode=918
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ public class ItemAnimationEffect extends TimedEntity {
|
|||||||
private final Vector2 to = new Vector2();
|
private final Vector2 to = new Vector2();
|
||||||
private final Item item;
|
private final Item item;
|
||||||
|
|
||||||
|
public Interpolation interp = Interpolation.fade;
|
||||||
|
public float endSize = 0.8f;
|
||||||
|
|
||||||
public ItemAnimationEffect(Item item, float x, float y, float tox, float toy) {
|
public ItemAnimationEffect(Item item, float x, float y, float tox, float toy) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
@@ -30,14 +33,14 @@ public class ItemAnimationEffect extends TimedEntity {
|
|||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
vec.set(from).interpolate(to, fin(), Interpolation.fade);
|
vec.set(from).interpolate(to, fin(), interp);
|
||||||
x = vec.x;
|
x = vec.x;
|
||||||
y = vec.y;
|
y = vec.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw() {
|
public void draw() {
|
||||||
float s = size * Mathf.curve(fout(), 0.1f);
|
float s = size * (1f-Mathf.curve(fin(), endSize));
|
||||||
Draw.rect(item.region, x, y, s, s);
|
Draw.rect(item.region, x, y, s, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package io.anuke.mindustry.input;
|
package io.anuke.mindustry.input;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.InputAdapter;
|
import com.badlogic.gdx.InputAdapter;
|
||||||
import com.badlogic.gdx.math.GridPoint2;
|
import com.badlogic.gdx.math.GridPoint2;
|
||||||
|
import com.badlogic.gdx.math.Interpolation;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import io.anuke.mindustry.content.blocks.Blocks;
|
import io.anuke.mindustry.content.blocks.Blocks;
|
||||||
import io.anuke.mindustry.entities.ItemAnimationEffect;
|
import io.anuke.mindustry.entities.ItemAnimationEffect;
|
||||||
@@ -78,6 +80,26 @@ public abstract class InputHandler extends InputAdapter{
|
|||||||
tile.drawx(), tile.drawy()).add();
|
tile.drawx(), tile.drawy()).add();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
Vector2 vec = Graphics.screen(player.x, player.y);
|
||||||
|
|
||||||
|
if(vec.dst(Gdx.input.getX(), Gdx.graphics.getHeight() - Gdx.input.getY()) > playerSelectRange) {
|
||||||
|
int sent = Mathf.clamp(stack.amount / 4, 1, 8);
|
||||||
|
float backTrns = 3f;
|
||||||
|
for (int i = 0; i < sent; i++) {
|
||||||
|
Timers.run(i, () -> {
|
||||||
|
float x = player.x + Angles.trnsx(rotation + 180f, backTrns),
|
||||||
|
y = player.y + Angles.trnsy(rotation + 180f, backTrns);
|
||||||
|
|
||||||
|
ItemAnimationEffect e = new ItemAnimationEffect(stack.item,
|
||||||
|
x, y, x + Mathf.range(20f), y + Mathf.range(20f)).add();
|
||||||
|
e.interp = Interpolation.pow3Out;
|
||||||
|
e.endSize = 0.5f;
|
||||||
|
e.lifetime = 20;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
player.inventory.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user