Tank animations & FX

This commit is contained in:
Anuken
2021-12-12 20:05:37 -05:00
parent 0d33768f58
commit 53b55a9f0e
11 changed files with 119 additions and 19 deletions

View File

@@ -509,6 +509,28 @@ public class Generators{
}
}
//generate tank animation
if(sample instanceof Tankc){
Pixmap pix = get(type.treadRegion);
//slice is always 1 pixel wide
Pixmap slice = pix.crop((int)type.treadRect.x, (int)type.treadRect.y, 1, (int)type.treadRect.height);
int frames = type.treadFrames;
for(int i = 0; i < frames; i++){
int pullOffset = 4;
Pixmap frame = new Pixmap(slice.width, slice.height);
for(int y = 0; y < slice.height; y++){
int idx = y + i;
if(idx >= slice.height){
idx -= slice.height;
idx += pullOffset;
}
frame.setRaw(0, y, slice.getRaw(0, idx));
}
save(frame, type.name + "-treads" + i);
}
}
outliner.get(type.jointRegion);
outliner.get(type.footRegion);
outliner.get(type.legBaseRegion);