WIP T3 tank

This commit is contained in:
Anuken
2022-05-02 14:29:32 -04:00
parent 07c24d7164
commit 5f0ef9b27e
11 changed files with 67 additions and 12 deletions

View File

@@ -80,7 +80,7 @@ public class UnitTypes{
public static @EntityDef({Unitc.class, BuildingTetherc.class, Payloadc.class}) UnitType manifold, assemblyDrone, effectDrone;
//tank
public static @EntityDef({Unitc.class, Tankc.class}) UnitType stell, locus, vanquish, conquer;
public static @EntityDef({Unitc.class, Tankc.class}) UnitType stell, locus, precept, vanquish, conquer;
//endregion
@@ -2585,6 +2585,52 @@ public class UnitTypes{
}});
}};
precept = new TankUnitType("precept"){{
hitSize = 26f;
treadPullOffset = 5;
speed = 0.64f;
rotateSpeed = 2f;
health = 2100;
armor = 8f;
itemCapacity = 0;
treadRects = new Rect[]{new Rect(16, 38, 30, 75), new Rect(44, 7, 17, 60)};
researchCostMultiplier = 0f;
weapons.add(new Weapon("precept-weapon"){{
layerOffset = 0.0001f;
reload = 30f;
shootY = 18f;
recoil = 1f;
rotate = true;
rotateSpeed = 1.3f;
mirror = false;
shootCone = 2f;
x = 0f;
y = -1f;
heatColor = Color.valueOf("f9350f");
cooldownTime = 30f;
bullet = new BasicBulletType(8f, 130){{
sprite = "missile-large";
width = 9.5f;
height = 15f;
lifetime = 30f;
hitSize = 6f;
shootEffect = Fx.shootTitan;
smokeEffect = Fx.shootSmokeTitan;
pierceCap = 2;
pierce = true;
pierceBuilding = true;
hitColor = backColor = trailColor = Color.valueOf("feb380");
frontColor = Color.white;
trailWidth = 3.1f;
trailLength = 8;
hitEffect = despawnEffect = Fx.blastExplosion;
splashDamageRadius = 20f;
splashDamage = 50f;
}};
}});
}};
vanquish = new TankUnitType("vanquish"){{
hitSize = 28f;
treadPullOffset = 4;

View File

@@ -332,7 +332,7 @@ public class BlockRenderer{
procLinks.clear();
procLights.clear();
var bounds = camera.bounds(Tmp.r3).grow(tilesize);
var bounds = camera.bounds(Tmp.r3).grow(tilesize * 2f);
//draw floor lights
floorTree.intersect(bounds, tile -> lightview.add(tile));

View File

@@ -362,17 +362,26 @@ public class UnitType extends UnlockableContent{
/** how much of a top part of a tread sprite is "cut off" relative to the pattern; this is corrected for */
public int treadPullOffset = 0;
//SEGMENTED / CRAWL UNITS
//SEGMENTED / CRAWL UNITS (this is WIP content!)
//for crawlers
/** number of independent segments */
public int segments = 0;
public float segmentSpacing = 2f, segmentScl = 4f, segmentPhase = 5f, segmentRotSpeed = 1f, segmentMaxRot = 30f;
/** magnitude of sine offset between segments */
public float segmentMag = 2f,
/** scale of sine offset between segments */
segmentScl = 4f,
/** index multiplier of sine offset between segments */
segmentPhase = 5f,
/** how fast each segment moves towards the next one */
segmentRotSpeed = 1f,
/** maximum difference between segment angles */
segmentMaxRot = 30f,
/** speed multiplier this unit will have when crawlSlowdownFrac is met. */
public float crawlSlowdown = 0.5f;
crawlSlowdown = 0.5f,
/** damage dealt to blocks under this tank/crawler every frame. */
public float crushDamage = 0f;
crushDamage = 0f,
/** the fraction of solids under this block necessary for it to reach crawlSlowdown. */
public float crawlSlowdownFrac = 0.55f;
crawlSlowdownFrac = 0.55f;
//MISSILE UNITS
@@ -1377,6 +1386,7 @@ public class UnitType extends UnlockableContent{
Draw.reset();
}
//TODO
public void drawCrawl(Crawlc crawl){
Unit unit = (Unit)crawl;
applyColor(unit);
@@ -1386,20 +1396,18 @@ public class UnitType extends UnlockableContent{
TextureRegion[] regions = p == 0 ? segmentOutlineRegions : segmentRegions;
for(int i = 0; i < segments; i++){
float trns = Mathf.sin(crawl.crawlTime() + i * segmentPhase, segmentScl, segmentSpacing);
float trns = Mathf.sin(crawl.crawlTime() + i * segmentPhase, segmentScl, segmentMag);
//at segment 0, rotation = segmentRot, but at the last segment it is rotation
float rot = Mathf.slerp(crawl.segmentRot(), unit.rotation, i / (float)(segments - 1));
float tx = Angles.trnsx(rot, trns), ty = Angles.trnsy(rot, trns);
//shadow
Draw.color(0f, 0f, 0f, 0.2f);
//Draw.rect(regions[i], unit.x + tx + 2f, unit.y + ty - 2f, rot - 90);
applyColor(unit);
//TODO merge outlines?
Draw.rect(regions[i], unit.x + tx, unit.y + ty, rot - 90);
}