Ground support unit implementations

This commit is contained in:
Anuken
2020-07-10 12:14:24 -04:00
parent f39702e1cc
commit baa9f22a0b
35 changed files with 1267 additions and 1106 deletions

View File

@@ -113,14 +113,14 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
Building tile = world.ent(x, y);
if(tile == null) return false;
if(tile.collide(base()) && type.collides(base(), tile) && !tile.dead() && (type.collidesTeam || tile.team() != team())){
if(tile.collide(base()) && type.collides(base(), tile) && !tile.dead() && (type.collidesTeam || tile.team != team)){
boolean remove = false;
if(tile.team() != team()){
if(tile.team != team){
remove = tile.collision(base());
}
if(remove){
if(remove || type.collidesTeam){
type.hitTile(base(), tile);
remove();
}

View File

@@ -93,8 +93,14 @@ abstract class HealthComp implements Entityc{
health = Mathf.clamp(health, 0, maxHealth);
}
/** Heals by a flat amount. */
void heal(float amount){
health += amount;
clampHealth();
}
/** Heals by a 0-1 fraction of max health. */
void healFract(float amount){
heal(amount * maxHealth);
}
}

View File

@@ -33,6 +33,8 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
private UnitType type;
boolean spawnedByCore;
transient float timer1, timer2;
public void moveAt(Vec2 vector){
moveAt(vector, type.accel);
}