Rectangles

This commit is contained in:
Anuken
2018-10-02 18:47:23 -04:00
parent f175bf2c82
commit 8523e5bf6b
9 changed files with 41 additions and 8 deletions

View File

@@ -42,6 +42,7 @@ public class Mechs implements ContentList{
{
drillPower = 1;
mineSpeed = 1.5f;
mass = 1.2f;
speed = 0.5f;
boostSpeed = 0.85f;
weapon = Weapons.blaster;
@@ -81,6 +82,7 @@ public class Mechs implements ContentList{
speed = 0.75f;
boostSpeed = 0.95f;
itemCapacity = 15;
mass = 0.9f;
armor = 30f;
weaponOffsetX = -1;
itemCapacity = 15;
@@ -115,6 +117,7 @@ public class Mechs implements ContentList{
itemCapacity = 70;
weaponOffsetY = -1;
weaponOffsetX = 1;
mass = 1.75f;
speed = 0.44f;
drag = 0.35f;
boostSpeed = 0.8f;
@@ -157,6 +160,7 @@ public class Mechs implements ContentList{
itemCapacity = 50;
speed = 0.36f;
boostSpeed = 0.6f;
mass = 4f;
shake = 4f;
weaponOffsetX = 1;
weaponOffsetY = 0;
@@ -233,6 +237,7 @@ public class Mechs implements ContentList{
speed = 0.11f;
maxSpeed = 10f;
drag = 0.01f;
mass = 2f;
armor = 5f;
weapon = Weapons.missiles;
trailColor = Color.valueOf("d3ddff");
@@ -287,6 +292,7 @@ public class Mechs implements ContentList{
speed = 0.12f;
maxSpeed = 10f;
drag = 0.035f;
mass = 2.5f;
turnCursor = false;
armor = 20f;
itemCapacity = 30;
@@ -309,6 +315,7 @@ public class Mechs implements ContentList{
speed = 0.32f;
maxSpeed = 10f;
drag = 0.06f;
mass = 3f;
armor = 30f;
itemCapacity = 60;
trailColor = Color.valueOf("feb380");

View File

@@ -48,6 +48,7 @@ public class UnitTypes implements ContentList{
maxVelocity = 1.1f;
speed = 0.2f;
drag = 0.4f;
mass = 1.75f;
range = 40f;
weapon = Weapons.chainBlaster;
health = 130;
@@ -57,7 +58,9 @@ public class UnitTypes implements ContentList{
maxVelocity = 0.8f;
speed = 0.18f;
drag = 0.4f;
mass = 3f;
range = 10f;
hitsize = 8f;
rotatespeed = 0.1f;
weapon = Weapons.flamethrower;
health = 440;
@@ -67,7 +70,8 @@ public class UnitTypes implements ContentList{
maxVelocity = 0.8f;
speed = 0.15f;
drag = 0.4f;
mass = 4f;
mass = 4.5f;
hitsize = 10f;
range = 10f;
rotatespeed = 0.06f;
weaponOffsetX = 1;
@@ -89,6 +93,7 @@ public class UnitTypes implements ContentList{
health = 250;
speed = 0.2f;
maxVelocity = 1.4f;
mass = 3f;
drag = 0.01f;
isFlying = true;
targetAir = false;
@@ -97,7 +102,7 @@ public class UnitTypes implements ContentList{
revenant = new UnitType("revenant", Revenant.class, Revenant::new){{
health = 250;
mass = 4f;
mass = 5f;
hitsize = 12f;
speed = 0.14f;
maxVelocity = 1.4f;
@@ -109,6 +114,7 @@ public class UnitTypes implements ContentList{
phantom = new UnitType("phantom", Phantom.class, Phantom::new){{
isFlying = true;
drag = 0.01f;
mass = 2f;
speed = 0.2f;
maxVelocity = 0.9f;
range = 70f;

View File

@@ -172,12 +172,13 @@ public class Logic extends Module{
EntityQuery.collideGroups(group, playerGroup);
for(EntityGroup other : unitGroups){
if(other == group || other.isEmpty()) continue;
if(other.isEmpty()) continue;
EntityQuery.collideGroups(group, other);
}
}
EntityQuery.collideGroups(bulletGroup, playerGroup);
EntityQuery.collideGroups(playerGroup, playerGroup);
world.pathfinder().update();
}

View File

@@ -98,7 +98,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
@Override
public void getHitbox(Rectangle rectangle){
rectangle.setSize(5).setCenter(x, y);
rectangle.setSize(mech.hitsize).setCenter(x, y);
}
@Override

View File

@@ -16,6 +16,7 @@ import io.anuke.mindustry.world.blocks.Floor;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.entities.impl.DestructibleEntity;
import io.anuke.ucore.entities.trait.DamageTrait;
import io.anuke.ucore.entities.trait.DrawTrait;
import io.anuke.ucore.entities.trait.SolidTrait;
import io.anuke.ucore.graphics.Draw;
@@ -49,6 +50,11 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
protected CarryTrait carrier;
protected float drownTime;
@Override
public boolean movable(){
return true;
}
@Override
public UnitInventory getInventory(){
return inventory;
@@ -94,8 +100,13 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
@Override
public boolean collides(SolidTrait other){
return true;//other instanceof DamageTrait && other
// instanceof TeamTrait && state.teams.areEnemies((((TeamTrait) other).getTeam()), team) && !isDead();
if(isDead()) return true;
if(other instanceof DamageTrait){
return other instanceof TeamTrait && state.teams.areEnemies((((TeamTrait) other).getTeam()), team);
}else{
return other instanceof Unit && ((Unit) other).isFlying() == isFlying();
}
}
@Override

View File

@@ -2,6 +2,7 @@ package io.anuke.mindustry.entities.traits;
import io.anuke.mindustry.game.Team;
import io.anuke.ucore.entities.trait.PosTrait;
import io.anuke.ucore.entities.trait.SolidTrait;
import io.anuke.ucore.entities.trait.VelocityTrait;
/**
@@ -14,10 +15,16 @@ public interface TargetTrait extends PosTrait, VelocityTrait{
Team getTeam();
default float getTargetVelocityX(){
if(this instanceof SolidTrait){
return ((SolidTrait) this).getDeltaX();
}
return getVelocity().x;
}
default float getTargetVelocityY(){
if(this instanceof SolidTrait){
return ((SolidTrait) this).getDeltaY();
}
return getVelocity().y;
}

View File

@@ -26,7 +26,7 @@ public class UnitType extends UnlockableContent{
public final String name;
public final String description;
public float health = 60;
public float hitsize = 5f;
public float hitsize = 7f;
public float hitsizeTile = 4f;
public float speed = 0.4f;
public float range = 160;

View File

@@ -27,6 +27,7 @@ public class Mech extends UnlockableContent{
public float shake = 0f;
public float armor = 1f;
public float hitsize = 6f;
public float cellTrnsY = 0f;
public float mineSpeed = 1f;
public int drillPower = -1;