This commit is contained in:
Anuken
2020-02-06 11:37:22 -05:00
parent a11f6efe0a
commit 6a99a3922e
46 changed files with 2155 additions and 1871 deletions

View File

@@ -0,0 +1,29 @@
package mindustry.entities.def;
import arc.util.ArcAnnotate.*;
import mindustry.annotations.Annotations.*;
import mindustry.gen.*;
@Component
abstract class ChildComp implements Posc{
transient float x, y;
private @Nullable Posc parent;
private float offsetX, offsetY;
@Override
public void add(){
if(parent != null){
offsetX = x - parent.getX();
offsetY = y - parent.getY();
}
}
@Override
public void update(){
if(parent != null){
x = parent.getX() + offsetX;
y = parent.getY() + offsetY;
}
}
}