mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-03-17 12:21:19 -07:00
Implemented item dumping
This commit is contained in:
parent
4e77f24a06
commit
913ee34c8d
3 changed files with 28 additions and 3 deletions
|
|
@ -1,5 +1,5 @@
|
|||
#Autogenerated file. Do not modify.
|
||||
#Sat Apr 14 11:58:08 EDT 2018
|
||||
#Sat Apr 14 13:47:10 EDT 2018
|
||||
version=release
|
||||
androidBuildCode=918
|
||||
name=Mindustry
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ public class ItemAnimationEffect extends TimedEntity {
|
|||
private final Vector2 to = new Vector2();
|
||||
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) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
|
@ -30,14 +33,14 @@ public class ItemAnimationEffect extends TimedEntity {
|
|||
public void update() {
|
||||
super.update();
|
||||
|
||||
vec.set(from).interpolate(to, fin(), Interpolation.fade);
|
||||
vec.set(from).interpolate(to, fin(), interp);
|
||||
x = vec.x;
|
||||
y = vec.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package io.anuke.mindustry.input;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.InputAdapter;
|
||||
import com.badlogic.gdx.math.GridPoint2;
|
||||
import com.badlogic.gdx.math.Interpolation;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.entities.ItemAnimationEffect;
|
||||
|
|
@ -78,6 +80,26 @@ public abstract class InputHandler extends InputAdapter{
|
|||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue