Implemented ground mech boosting
This commit is contained in:
29
core/src/mindustry/entities/comp/ChildComp.java
Normal file
29
core/src/mindustry/entities/comp/ChildComp.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package mindustry.entities.comp;
|
||||
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
@Component
|
||||
abstract class ChildComp implements Posc{
|
||||
@Import float x, y;
|
||||
|
||||
@Nullable Posc parent;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user