1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-11 08:15:35 +03:00

Fixed tank tread rects

This commit is contained in:
Anuken 2022-05-09 16:55:08 -04:00
parent a82a6f4324
commit 6cc30e6ebd
7 changed files with 13 additions and 12 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 706 B

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -2460,7 +2460,7 @@ public class UnitTypes{
health = 800;
armor = 5f;
itemCapacity = 0;
treadRects = new Rect[]{new Rect(12, 7, 14, 51)};
treadRects = new Rect[]{new Rect(12 - 32f, 7 - 32f, 14, 51)};
researchCostMultiplier = 0f;
weapons.add(new Weapon("stell-weapon"){{
@ -2501,7 +2501,7 @@ public class UnitTypes{
health = 2100;
armor = 8f;
itemCapacity = 0;
treadRects = new Rect[]{new Rect(17, 10, 19, 76)};
treadRects = new Rect[]{new Rect(17 - 96f/2f, 10 - 96f/2f, 19, 76)};
researchCostMultiplier = 0f;
weapons.add(new Weapon("locus-weapon"){{
@ -2588,7 +2588,7 @@ public class UnitTypes{
health = 4500;
armor = 10f;
itemCapacity = 0;
treadRects = new Rect[]{new Rect(16, 38, 30, 75), new Rect(44, 7, 17, 60)};
treadRects = new Rect[]{new Rect(16 - 60f, 38 - 60f, 30, 75), new Rect(44 - 60f, 7 - 60f, 17, 60)};
researchCostMultiplier = 0f;
weapons.add(new Weapon("precept-weapon"){{
@ -2654,8 +2654,7 @@ public class UnitTypes{
armor = 20f;
itemCapacity = 0;
crushDamage = 13f / 5f;
treadRects = new Rect[]{new Rect(22, 16, 28, 130)};
treadRects = new Rect[]{new Rect(22 - 154f/2f, 16 - 154f/2f, 28, 130)};
weapons.add(new Weapon("vanquish-weapon"){{
layerOffset = 0.0001f;
@ -2749,7 +2748,9 @@ public class UnitTypes{
armor = 25f;
crushDamage = 25f / 5f;
rotateSpeed = 0.8f;
treadRects = new Rect[]{new Rect(27, 152, 56, 73), new Rect(24, 51 - 9, 29, 17), new Rect(59, 18 - 9, 39, 19)};
float xo = 231f/2f, yo = 231f/2f;
treadRects = new Rect[]{new Rect(27 - xo, 152 - yo, 56, 73), new Rect(24 - xo, 51 - 9 - yo, 29, 17), new Rect(59 - xo, 18 - 9 - yo, 39, 19)};
weapons.add(new Weapon("conquer-weapon"){{
layerOffset = 0.1f;

View File

@ -37,8 +37,8 @@ abstract class TankComp implements Posc, Flyingc, Hitboxc, Unitc, ElevationMovec
//first rect should always be at the back
var treadRect = type.treadRects[0];
float xOffset = (treadRegion.width/2f - (treadRect.x + treadRect.width/2f)) / 4f;
float yOffset = (treadRegion.height/2f - (treadRect.y + treadRect.height/2f)) / 4f;
float xOffset = (-(treadRect.x + treadRect.width/2f)) / 4f;
float yOffset = (-(treadRect.y + treadRect.height/2f)) / 4f;
for(int i : Mathf.signs){
Tmp.v1.set(xOffset * i, yOffset - treadRect.height / 2f / 4f).rotate(rotation - 90);

View File

@ -362,7 +362,7 @@ public class UnitType extends UnlockableContent{
//TANK UNITS
/** list of treads as rectangles in IMAGE COORDINATES. these are mirrored, and should match the coordinates you see in an image editor. */
/** list of treads as rectangles in IMAGE COORDINATES, relative to the center. these are mirrored. */
public Rect[] treadRects = {};
/** number of frames of movement in a tread */
public int treadFrames = 18;
@ -1303,8 +1303,8 @@ public class UnitType extends UnlockableContent{
for(int i = 0; i < treadRects.length; i ++){
var region = treadRegions[i][frame];
var treadRect = treadRects[i];
float xOffset = treadRegion.width/2f - (treadRect.x + treadRect.width/2f);
float yOffset = treadRegion.height/2f - (treadRect.y + treadRect.height/2f);
float xOffset = -(treadRect.x + treadRect.width/2f);
float yOffset = -(treadRect.y + treadRect.height/2f);
for(int side : Mathf.signs){
Tmp.v1.set(xOffset * side, yOffset).rotate(unit.rotation - 90);

View File

@ -530,7 +530,7 @@ public class Generators{
for(int r = 0; r < type.treadRects.length; r++){
Rect treadRect = type.treadRects[r];
//slice is always 1 pixel wide
Pixmap slice = pix.crop((int)treadRect.x, (int)treadRect.y, 1, (int)treadRect.height);
Pixmap slice = pix.crop((int)(treadRect.x + pix.width/2f), (int)(treadRect.y + pix.height/2f), 1, (int)treadRect.height);
int frames = type.treadFrames;
for(int i = 0; i < frames; i++){
int pullOffset = type.treadPullOffset;