public SpriteManager(Game game, Fighter lutador1, Fighter lutador2) : base(game) { this.lutador1 = lutador1; this.lutador2 = lutador2; simulador = new PhysicsSimulator(new Vector2(0, 10)); //simulador.Add(lutador1.Body); //simulador.Add(lutador1.Geometry); groundBody = BodyFactory.Instance.CreateRectangleBody( 800, 10, 1); groundGeom = GeomFactory.Instance.CreateRectangleGeom(groundBody, 800, 10); groundBody.Position = new Vector2(0, 550); groundBody.IsStatic = true; groundGeom.RestitutionCoefficient = .2f; groundGeom.FrictionCoefficient = .2f; barra = ContentManagerFacade.Load<Texture2D>("barra"); simulador.Add(groundBody); simulador.Add(groundGeom); }
public SpriteManager(Game game, Fighter lutador1, Fighter lutador2) : base(game) { this.lutador1 = lutador1; this.lutador2 = lutador2; }
private Vector2 getPosicaoCorrigida(ref Fighter lutador) { Vector2 posicao = lutador.CurrentPosition; float rightLowerXCorner = posicao.X + lutador.PosicaoDeRepouso.CurrentStep.Width * 2; float rightLowerYCorner = posicao.Y + lutador.PosicaoDeRepouso.CurrentStep.Height * 2; float wrongNewRightLowerXCorner = posicao.X + lutador.CurrentAction.CurrentStep.Width * 2; float wrongNewRightLowerYCorner = posicao.Y + lutador.CurrentAction.CurrentStep.Height * 2; Vector2 posicaoCorrigida = new Vector2(); posicaoCorrigida.X = posicao.X - (wrongNewRightLowerXCorner - rightLowerXCorner); posicaoCorrigida.Y = posicao.Y - (wrongNewRightLowerYCorner - rightLowerYCorner); return posicaoCorrigida; }