New insectoid almost done + DestroyBlockObjective
This commit is contained in:
@@ -21,7 +21,7 @@ import static mindustry.Vars.*;
|
||||
abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
private static final Vec2 straightVec = new Vec2();
|
||||
|
||||
@Import float x, y, rotation;
|
||||
@Import float x, y, rotation, speedMultiplier;
|
||||
@Import UnitType type;
|
||||
@Import Team team;
|
||||
|
||||
@@ -128,7 +128,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
int div = Math.max(legs.length / type.legGroupSize, 2);
|
||||
moveSpace = legLength / 1.6f / (div / 2f) * type.legMoveSpace;
|
||||
//TODO should move legs even when still, based on speed. also, to prevent "slipping", make sure legs move when they are too far from their destination
|
||||
totalLength += type.legContinuousMove ? type.speed : Mathf.dst(deltaX(), deltaY());
|
||||
totalLength += type.legContinuousMove ? type.speed * speedMultiplier : Mathf.dst(deltaX(), deltaY());
|
||||
|
||||
float trns = moveSpace * 0.85f * type.legTrns;
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ public abstract class DrawPart{
|
||||
public boolean turretShading;
|
||||
/** If true, the layer is overridden to be under the weapon/turret itself. */
|
||||
public boolean under = false;
|
||||
/** For units, this is the index of the weapon this part gets its progress for. */
|
||||
public int weaponIndex = 0;
|
||||
|
||||
public abstract void draw(PartParams params);
|
||||
public abstract void load(String name);
|
||||
@@ -81,6 +83,11 @@ public abstract class DrawPart{
|
||||
return p -> 1f - get(p);
|
||||
}
|
||||
|
||||
default PartProgress slope(){
|
||||
return p -> Mathf.slope(get(p));
|
||||
}
|
||||
|
||||
|
||||
default PartProgress clamp(){
|
||||
return p -> Mathf.clamp(get(p));
|
||||
}
|
||||
|
||||
53
core/src/mindustry/entities/part/FlarePart.java
Normal file
53
core/src/mindustry/entities/part/FlarePart.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package mindustry.entities.part;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.graphics.*;
|
||||
|
||||
public class FlarePart extends DrawPart{
|
||||
public int sides = 4;
|
||||
public float radius = 100f, radiusTo = -1f, stroke = 6f, innerScl = 0.5f, innerRadScl = 0.33f;
|
||||
public float x, y, rotation, rotMove;
|
||||
public boolean followRotation;
|
||||
public Color color1 = Pal.techBlue, color2 = Color.white;
|
||||
public PartProgress progress = PartProgress.warmup;
|
||||
public float layer = Layer.effect;
|
||||
|
||||
@Override
|
||||
public void draw(PartParams params){
|
||||
float z = Draw.z();
|
||||
if(layer > 0) Draw.z(layer);
|
||||
|
||||
float prog = progress.getClamp(params);
|
||||
int i = params.sideOverride == -1 ? 0 : params.sideOverride;
|
||||
|
||||
float sign = (i == 0 ? 1 : -1) * params.sideMultiplier;
|
||||
Tmp.v1.set(x * sign, y).rotate(params.rotation - 90);
|
||||
|
||||
float
|
||||
rx = params.x + Tmp.v1.x,
|
||||
ry = params.y + Tmp.v1.y,
|
||||
rot = (followRotation ? params.rotation : 0f) + rotMove * prog + rotation,
|
||||
rad = radiusTo < 0 ? radius : Mathf.lerp(radius, radiusTo, prog);
|
||||
|
||||
Draw.color(color1);
|
||||
for(int j = 0; j < sides; j++){
|
||||
Drawf.tri(rx, ry, stroke, rad, j * 360f / sides + rot);
|
||||
}
|
||||
|
||||
Draw.color(color2);
|
||||
for(int j = 0; j < sides; j++){
|
||||
Drawf.tri(rx, ry, stroke * innerScl, rad * innerRadScl, j * 360f / sides + rot);
|
||||
}
|
||||
|
||||
Draw.color();
|
||||
Draw.z(z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(String name){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class RegionPart extends DrawPart{
|
||||
/** Progress function for heat alpha. */
|
||||
public PartProgress heatProgress = PartProgress.heat;
|
||||
public Blending blending = Blending.normal;
|
||||
public float layer = -1, layerOffset = 0f;
|
||||
public float layer = -1, layerOffset = 0f, heatLayerOffset = 1f;
|
||||
public float outlineLayerOffset = -0.001f;
|
||||
public float x, y, rotation;
|
||||
public float moveX, moveY, moveRot;
|
||||
@@ -62,7 +62,7 @@ public class RegionPart extends DrawPart{
|
||||
|
||||
float prevZ = Draw.z();
|
||||
float prog = progress.getClamp(params);
|
||||
float mx = moveX * prog, my = moveY * prog, mr = moveRot * prog;
|
||||
float mx = moveX * prog, my = moveY * prog, mr = moveRot * prog + rotation;
|
||||
|
||||
if(moves.size > 0){
|
||||
for(int i = 0; i < moves.size; i++){
|
||||
@@ -111,7 +111,7 @@ public class RegionPart extends DrawPart{
|
||||
}
|
||||
|
||||
if(heat.found()){
|
||||
Drawf.additive(heat, heatColor.write(Tmp.c1).a(heatProgress.getClamp(params) * heatColor.a), rx, ry, rot, turretShading ? Layer.turretHeat : z + 1f);
|
||||
Drawf.additive(heat, heatColor.write(Tmp.c1).a(heatProgress.getClamp(params) * heatColor.a), rx, ry, rot, turretShading ? Layer.turretHeat : Draw.z() + heatLayerOffset);
|
||||
}
|
||||
|
||||
Draw.xscl = 1f;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ShapePart extends DrawPart{
|
||||
}
|
||||
|
||||
if(!circle){
|
||||
Fill.poly(rx, ry, sides, rad, moveRot * prog * sign + params.rotation - 90);
|
||||
Fill.poly(rx, ry, sides, rad, moveRot * prog * sign + params.rotation - 90 * sign + rotation * sign);
|
||||
}else{
|
||||
Fill.circle(rx, ry, rad);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user