Actual updating and rendering

This commit is contained in:
Anuken
2020-02-06 13:40:07 -05:00
parent 6fe5663f79
commit ddecb2d831
8 changed files with 33 additions and 16 deletions

View File

@@ -6,7 +6,7 @@ import mindustry.annotations.Annotations.*;
import mindustry.gen.*;
@Component
abstract class DrawShadowComp implements Drawc, Rotc, Flyingc, DrawLayerFlyingShadowsc, DrawLayerGroundShadowsc{
abstract class DrawShadowComp implements Drawc, Rotc, Flyingc, DrawLayerFlyingShadowsc{
static final float shadowTX = -12, shadowTY = -13, shadowColor = Color.toFloatBits(0, 0, 0, 0.22f);
transient float x, y, rotation;
@@ -16,19 +16,6 @@ abstract class DrawShadowComp implements Drawc, Rotc, Flyingc, DrawLayerFlyingSh
@Override
public void drawFlyingShadows(){
if(isFlying()){
drawShadow();
}
}
@Override
public void drawGroundShadows(){
if(isGrounded()){
drawShadow();
}
}
void drawShadow(){
if(!isGrounded()){
Draw.color(shadowColor);
Draw.rect(getShadowRegion(), x + shadowTX * elevation(), y + shadowTY * elevation(), rotation - 90);
Draw.color();

View File

@@ -2,6 +2,7 @@ package mindustry.entities.def;
import arc.func.*;
import mindustry.annotations.Annotations.*;
import mindustry.entities.*;
import mindustry.gen.*;
import java.io.*;
@@ -12,7 +13,7 @@ import static mindustry.Vars.player;
@BaseComponent
abstract class EntityComp{
private boolean added;
int id;
int id = EntityGroup.nextId();
boolean isAdded(){
return added;

View File

@@ -19,6 +19,10 @@ abstract class PosComp implements Position{
this.y = y;
}
void set(Position pos){
set(pos.getX(), pos.getY());
}
void trns(float x, float y){
set(this.x + x, this.y + y);
}