Fixed many various physics bugs
This commit is contained in:
@@ -46,7 +46,6 @@ public class Mechs implements ContentList{
|
||||
speed = 0.5f;
|
||||
boostSpeed = 0.85f;
|
||||
weapon = Weapons.blaster;
|
||||
maxSpeed = 4f;
|
||||
trailColorTo = Color.valueOf("ffd37f");
|
||||
armor = 20f;
|
||||
}
|
||||
@@ -89,7 +88,6 @@ public class Mechs implements ContentList{
|
||||
weaponOffsetY = -1;
|
||||
weapon = Weapons.shockgun;
|
||||
trailColorTo = Color.valueOf("d3ddff");
|
||||
maxSpeed = 5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,7 +120,6 @@ public class Mechs implements ContentList{
|
||||
drag = 0.35f;
|
||||
boostSpeed = 0.8f;
|
||||
weapon = Weapons.healBlaster;
|
||||
maxSpeed = 5f;
|
||||
armor = 15f;
|
||||
trailColorTo = Palette.heal;
|
||||
}
|
||||
@@ -166,7 +163,6 @@ public class Mechs implements ContentList{
|
||||
weaponOffsetY = 0;
|
||||
weapon = Weapons.swarmer;
|
||||
trailColorTo = Color.valueOf("feb380");
|
||||
maxSpeed = 3.5f;
|
||||
armor = 45f;
|
||||
}
|
||||
|
||||
@@ -218,7 +214,6 @@ public class Mechs implements ContentList{
|
||||
drillPower = 1;
|
||||
mineSpeed = 0.9f;
|
||||
speed = 0.4f;
|
||||
maxSpeed = 10f;
|
||||
drag = 0.1f;
|
||||
armor = 10f;
|
||||
weapon = Weapons.blasterSmall;
|
||||
@@ -235,7 +230,6 @@ public class Mechs implements ContentList{
|
||||
{
|
||||
drillPower = -1;
|
||||
speed = 0.11f;
|
||||
maxSpeed = 10f;
|
||||
drag = 0.01f;
|
||||
mass = 2f;
|
||||
armor = 5f;
|
||||
@@ -290,7 +284,6 @@ public class Mechs implements ContentList{
|
||||
{
|
||||
drillPower = 2;
|
||||
speed = 0.12f;
|
||||
maxSpeed = 10f;
|
||||
drag = 0.035f;
|
||||
mass = 2.5f;
|
||||
turnCursor = false;
|
||||
@@ -313,7 +306,6 @@ public class Mechs implements ContentList{
|
||||
drillPower = 4;
|
||||
mineSpeed = 1.3f;
|
||||
speed = 0.32f;
|
||||
maxSpeed = 10f;
|
||||
drag = 0.06f;
|
||||
mass = 3f;
|
||||
armor = 30f;
|
||||
|
||||
@@ -24,6 +24,8 @@ public class UnitTypes implements ContentList{
|
||||
maxVelocity = 1.7f;
|
||||
range = 40f;
|
||||
health = 45;
|
||||
hitsize = 4f;
|
||||
mass = 0.1f;
|
||||
weapon = Weapons.droneBlaster;
|
||||
trailColor = Color.valueOf("ffd37f");
|
||||
}
|
||||
@@ -84,6 +86,7 @@ public class UnitTypes implements ContentList{
|
||||
speed = 0.3f;
|
||||
maxVelocity = 1.9f;
|
||||
drag = 0.01f;
|
||||
mass = 1.5f;
|
||||
weapon = Weapons.chainBlaster;
|
||||
isFlying = true;
|
||||
health = 70;
|
||||
|
||||
@@ -190,8 +190,8 @@ public class TurretBlocks extends BlockList implements ContentList{
|
||||
cyclone = new ItemTurret("cyclone"){{
|
||||
ammoTypes = new AmmoType[]{AmmoTypes.flakExplosive, AmmoTypes.flakPlastic, AmmoTypes.flakSurge};
|
||||
xRand = 4f;
|
||||
reload = 10f;
|
||||
range = 140f;
|
||||
reload = 8f;
|
||||
range = 145f;
|
||||
size = 3;
|
||||
recoil = 3f;
|
||||
rotatespeed = 10f;
|
||||
|
||||
@@ -206,8 +206,8 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
velocity.limit(getMaxVelocity()).scl(status.getSpeedMultiplier());
|
||||
|
||||
if(isFlying()){
|
||||
x += velocity.x / getMass() * Timers.delta();
|
||||
y += velocity.y / getMass() * Timers.delta();
|
||||
x += velocity.x * Timers.delta();
|
||||
y += velocity.y * Timers.delta();
|
||||
}else{
|
||||
boolean onLiquid = floor.isLiquid;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
bullet.type = type;
|
||||
bullet.lifeScl = lifetimeScl;
|
||||
|
||||
bullet.set(x, y);
|
||||
bullet.set(x - bullet.velocity.x * Timers.delta(), y - bullet.velocity.y * Timers.delta());
|
||||
bullet.add();
|
||||
|
||||
return bullet;
|
||||
@@ -192,7 +192,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
super.update();
|
||||
|
||||
if(type.hitTiles && collidesTiles() && !supressCollision && initialized){
|
||||
world.raycastEach(world.toTile(x), world.toTile(y), world.toTile(x + velocity.x), world.toTile(y + velocity.y), (x, y) -> {
|
||||
world.raycastEach(world.toTile(lastPosition().x), world.toTile(lastPosition().y), world.toTile(x), world.toTile(y), (x, y) -> {
|
||||
|
||||
Tile tile = world.tile(x, y);
|
||||
if(tile == null) return false;
|
||||
|
||||
@@ -125,6 +125,10 @@ public abstract class GroundUnit extends BaseUnit{
|
||||
rotation = Mathf.slerpDelta(rotation, velocity.angle(), type.rotatespeed);
|
||||
}
|
||||
|
||||
if(!velocity.isZero()){
|
||||
baseRotation = Mathf.slerpDelta(baseRotation, velocity.angle(), 0.05f);
|
||||
}
|
||||
|
||||
if(stuckTime < 1f){
|
||||
walkTime += Timers.delta();
|
||||
}
|
||||
@@ -268,10 +272,7 @@ public abstract class GroundUnit extends BaseUnit{
|
||||
|
||||
if(tile == targetTile) return;
|
||||
|
||||
vec.trns(baseRotation, type.speed);
|
||||
|
||||
baseRotation = Mathf.slerpDelta(baseRotation, angleTo(targetTile), 0.05f);
|
||||
velocity.add(vec);
|
||||
velocity.add(vec.trns(angleTo(targetTile), type.speed));
|
||||
}
|
||||
|
||||
protected void moveAwayFromCore(){
|
||||
@@ -292,9 +293,6 @@ public abstract class GroundUnit extends BaseUnit{
|
||||
|
||||
if(tile == targetTile || core == null || distanceTo(core) < 90f) return;
|
||||
|
||||
vec.trns(baseRotation, type.speed);
|
||||
|
||||
baseRotation = Mathf.slerpDelta(baseRotation, angleTo(targetTile), 0.05f);
|
||||
velocity.add(vec);
|
||||
velocity.add(vec.trns(angleTo(targetTile), type.speed));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Mech extends UnlockableContent{
|
||||
|
||||
public boolean flying;
|
||||
public float speed = 1.1f;
|
||||
public float maxSpeed = 1.1f;
|
||||
public float maxSpeed = 10f;
|
||||
public float boostSpeed = 0.75f;
|
||||
public float drag = 0.4f;
|
||||
public float mass = 1f;
|
||||
|
||||
Reference in New Issue
Block a user