Fixed startup crash, implemented basic player animations

This commit is contained in:
Anuken
2018-03-14 23:03:27 -04:00
parent 01ba051c43
commit 0b2a933faa
18 changed files with 398 additions and 381 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

View File

Before

Width:  |  Height:  |  Size: 309 B

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 254 B

View File

@ -339,8 +339,10 @@ keybind.weapon_6.name=weapon_6
mode.waves.name=waves
mode.sandbox.name=sandbox
mode.freebuild.name=freebuild
upgrade.standard.name=standard
upgrade.standard.description=The standard mech.
upgrade.standard-mech.name=standard
upgrade.standard-mech.description=The standard mech.
upgrade.standard-ship.name=standard ship
upgrade.standard-ship.description=The standard ship.
upgrade.blaster.name=blaster
upgrade.blaster.description=Shoots a slow, weak bullet.
upgrade.triblaster.name=triblaster

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

View File

@ -1,7 +1,7 @@
#Autogenerated file. Do not modify.
#Wed Mar 14 20:14:54 EDT 2018
#Wed Mar 14 22:59:39 EDT 2018
version=release
androidBuildCode=500
androidBuildCode=520
name=Mindustry
code=3.4
build=custom build

View File

@ -66,9 +66,7 @@ public class Logic extends Module {
state.lastUpdated = state.wave + 1;
}
for(EnemySpawn spawn : spawns){
//TODO spawn enemies for that spawnpoint
}
//TODO spawn enemies
state.wave ++;
state.wavetime = wavespace * state.difficulty.timeScaling;

View File

@ -184,8 +184,8 @@ public class Renderer extends RendererModule{
Graphics.shader(Shaders.outline, false);
Entities.draw(enemyGroup);
Entities.draw(playerGroup, p -> !p.mech.flying);
Graphics.shader();
Entities.draw(playerGroup, p -> !p.mech.flying);
Entities.draw(Entities.defaultGroup());

View File

@ -45,6 +45,7 @@ public class Player extends Unit{
public int clientid = -1;
public boolean isLocal = false;
public Timer timer = new Timer(4);
public float footRotation, walktime;
private Vector2 movement = new Vector2();
private Translator tr = new Translator();
@ -116,35 +117,46 @@ public class Player extends Unit{
@Override
public void drawSmooth(){
if((debug && (!showPlayer || !showUI)) || dead) return;
Graphics.beginShaders(Shaders.outline);
boolean snap = snapCamera && Settings.getBool("smoothcam") && Settings.getBool("pixelate") && isLocal;
String mname = "mech-" + mech.name;
String mname = mech.name;
Shaders.outline.color.set(getColor());
Shaders.outline.lighten = 0f;
Shaders.outline.region = Draw.region(mname);
Shaders.outline.apply();
float px = x, py =y;
if(snap){
x = (int)x;
y = (int)y;
}
float ft = Mathf.sin(walktime, 6f, 2f);
for(int i : Mathf.signs){
tr.trns(footRotation, ft * i);
Draw.rect(mname + "-leg", x + tr.x, y + tr.y, 12f * i, 12f - Mathf.clamp(ft*i, 0, 2), footRotation- 90);
}
Draw.rect(mname + "-base", x, y,footRotation- 90);
Draw.rect(mname, x, y, rotation -90);
for (int i : Mathf.signs) {
Weapon weapon = i < 0 ? weaponLeft : weaponRight;
tr.trns(rotation - 90, 3*i, 2);
tr.trns(rotation - 90, 4*i, 3);
float w = i > 0 ? -8 : 8;
if(snap){
Draw.rect(weapon.name + "-equip", (int)x + tr.x, (int)y + tr.y, w, 8, rotation - 90);
}else{
Draw.rect(weapon.name + "-equip", x + tr.x, y + tr.y, w, 8, rotation - 90);
}
Draw.rect(weapon.name + "-equip", x + tr.x, y + tr.y, w, 8, rotation - 90);
}
if(snap){
Draw.rect(mname, (int)x, (int)y, rotation -90);
}else{
Draw.rect(mname, x, y, rotation -90);
}
Graphics.endShaders();
Graphics.flush();
x = px;
y = py;
}
@Override
@ -224,9 +236,15 @@ public class Player extends Unit{
y += movement.y*Timers.delta();
}
if(!movement.isZero()){
walktime += Timers.delta();
footRotation = Mathf.slerpDelta(footRotation, movement.angle(), 0.13f);
}
if(!shooting){
if(!movement.isZero())
if(!movement.isZero()) {
rotation = Mathf.slerpDelta(rotation, movement.angle(), 0.13f);
}
}else{
float angle = Angles.mouseAngle(x, y);
this.rotation = Mathf.slerpDelta(this.rotation, angle, 0.1f);

View File

@ -3,7 +3,7 @@ package io.anuke.mindustry.resource;
public class Mech extends Upgrade{
public static final Mech
standard = new Mech("standard", false),
standard = new Mech("standard-mech", false),
standardShip = new Mech("standard-ship", true);
public boolean flying;

View File

@ -96,11 +96,10 @@ public class PlayerListFragment implements Fragment{
button.margin(5).marginBottom(10);
Stack stack = new Stack();
BorderImage image = new BorderImage(Draw.region("mech-" + player.mech.name), 3f);
BorderImage image = new BorderImage(Draw.region(player.mech.name), 3f);
stack.add(image);
stack.add(new Element(){
public void draw(){
float s = getWidth() / 12f;