This commit is contained in:
Anuken
2020-06-23 16:27:32 -04:00
parent ba78eab30a
commit fc8e1d5b6d
12 changed files with 31 additions and 40 deletions

View File

@@ -175,7 +175,6 @@ public class Block extends UnlockableContent{
protected Prov<Tilec> entityType = null; //initialized later
public ObjectMap<Class<?>, Cons2> configurations = new ObjectMap<>();
//TODO move
protected TextureRegion[] generatedIcons;
protected TextureRegion[] variantRegions, editorVariantRegions;
@@ -183,7 +182,6 @@ public class Block extends UnlockableContent{
public @Load("@-team") TextureRegion teamRegion;
public TextureRegion[] teamRegions;
//TODO move
public static TextureRegion[][] cracks;
protected static final Seq<Tile> tempTiles = new Seq<>();
protected static final Seq<Tilec> tempTileEnts = new Seq<>();

View File

@@ -40,23 +40,16 @@ public class DeflectorWall extends Wall{
}
@Override
public void collision(Bulletc bullet){
public boolean collision(Bulletc bullet){
super.collision(bullet);
//TODO fix and test
//doesn't reflect powerful bullets
if(bullet.damage() > maxDamageDeflect) return;
if(bullet.damage() > maxDamageDeflect) return true;
float penX = Math.abs(getX() - bullet.x()), penY = Math.abs(getY() - bullet.y());
//translate bullet back to where it was upon collision
bullet.trns(-bullet.vel().x, -bullet.vel().y);
bullet.hitbox(rect2);
Vec2 position = Geometry.raycastRect(bullet.x() - bullet.vel().x*Time.delta(), bullet.y() - bullet.vel().y*Time.delta(), bullet.x() + bullet.vel().x*Time.delta(), bullet.y() + bullet.vel().y*Time.delta(),
rect.setSize(size * tilesize + rect2.width*2 + rect2.height*2).setCenter(getX(), getY()));
if(position != null){
bullet.set(position.x, position.y);
}
float penX = Math.abs(x - bullet.x()), penY = Math.abs(y - bullet.y());
if(penX > penY){
bullet.vel().x *= -1;
@@ -64,14 +57,13 @@ public class DeflectorWall extends Wall{
bullet.vel().y *= -1;
}
//bullet.updateVelocity();
bullet.owner(this);
bullet.team(team());
bullet.team(team);
bullet.time(bullet.time() + 1f);
//TODO deflect
//bullet.deflect();
hit = 1f;
return false;
}
}
}

View File

@@ -16,11 +16,13 @@ public class SurgeWall extends Wall{
public class SurgeEntity extends TileEntity{
@Override
public void collision(Bulletc bullet){
public boolean collision(Bulletc bullet){
super.collision(bullet);
if(Mathf.chance(lightningChance)){
Lightning.create(team(), Pal.surge, lightningDamage, x, y, bullet.rotation() + 180f, lightningLength);
}
return true;
}
}
}