public virtual void performPhysics(GameTime time) { tileIn = world.getBlock(location); if (tileIn != null && !tileIn.tags.Contains(TagReferencer.WATER)) { impulse += new Vector2(0, .5f * gravityMultiplier); } else { impulse += new Vector2(0, .05f * gravityMultiplier); } velocity += impulse; TileType tileOccupied = world.getBlock(location); TileType tileBelow = world.getBlock(location + new Vector2(0, Chunk.tileDrawWidth)); if (tileOccupied != null) { velocity -= velocity * (1 - tileOccupied.getFrictionMultiplier()) * frictionMultiplier; } if (collideBottom && tileBelow != null) { velocity -= velocity * (1 - tileBelow.getFrictionMultiplier()) * frictionMultiplier; } Vector2 potentialLocation = location + velocity; collideBottom = false; collideLeft = false; collideRight = false; collideTop = false; location = world.tryMove(this, new AABB((potentialLocation.X - width / 2), (potentialLocation.Y - height / 2), (width), (height))).Center; impulse = new Vector2(); if (tileIn != null && tileIn.tags.Contains(TagReferencer.WATER)) { for (int i = 0; i < Math.Floor(velocity.Length() / 3); i++) { world.addEntity(new ParticleBubble(new Vector2(location.X, location.Y + height / 2), world, new Vector2(), 75)); } if (rand.NextDouble() <= .02f) { world.addEntity(new ParticleBubble(location, world, new Vector2(), 75)); } } }