This project has moved. For the latest updates, please go here.

Hellp , Moving Body

Topics: Developer Forum, Project Management Forum, User Forum
Jan 22, 2015 at 12:52 AM
Edited Jan 22, 2015 at 1:13 AM
need the maximum of information about the body movement.

I'm making a game that the player is a ball pushing the boxes when I move to right movement is perfect , however left the collision happens before collision the object. appreciate help with jump too, I did the codes for Jump body slope in the box but when he goes flying away
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

using FarseerPhysics.Factories;
using FarseerPhysics;
using FarseerPhysics.Dynamics;
using FarseerPhysics.Dynamics.Contacts;
using FarseerPhysics.Dynamics.Joints;
using FarseerPhysics.Collision;
using FarseerPhysics.Collision.Shapes;
using FarseerPhysics.Common.ConvexHull;
using FarseerPhysics.Common.Decomposition;
using FarseerPhysics.Common.PhysicsLogic;
using FarseerPhysics.Common.PolygonManipulation;
using FarseerPhysics.Controllers;
using FarseerPhysics.Common;
using Poly2Tri.Triangulation;
using Poly2Tri.Triangulation.Delaunay.Sweep;
using Poly2Tri.Triangulation.Delaunay;
using Poly2Tri.Triangulation.Polygon;
using Poly2Tri.Triangulation.Sets;
using Poly2Tri.Triangulation.Util;
using FarseerPhysics.DebugViews;
using FarseerPhysics.SamplesFramework;

namespace Fraseer.Objetos
    class Player
        Body Pl1;
        Texture2D Pl1Tex;
        Vector2 direção;
        Vector2 Velocidade;
        public Player (Texture2D Texture , World Mundo , float X , float Y)
        Pl1Tex = Texture;
        Pl1 = new Body(Mundo);
        Pl1 = BodyFactory.CreateRectangle(Mundo, (float)ConvertUnits.ToSimUnits(Pl1Tex.Width), (float)ConvertUnits.ToSimUnits(Pl1Tex.Height),5);
        Pl1.Mass = 1f;
        Pl1.BodyType = BodyType.Dynamic;
        Pl1.Restitution = 0f;
        Pl1.Position = new Vector2(ConvertUnits.ToSimUnits(X), ConvertUnits.ToSimUnits(Y)); ;
        direção.X = (float)Math.Cos(MathHelper.ToRadians(Pl1.Rotation));
        direção.Y = (float)Math.Sin(MathHelper.ToRadians(Pl1.Rotation));
        Velocidade.X = direção.X * 2;
        Velocidade.Y = direção.Y * 2;

        public void MoveReigth()
            Pl1.ApplyLinearImpulse(Velocidade / 2);

        public void MoveLeft()
            Pl1.ApplyLinearImpulse(Velocidade * -2);

        public void PularDireita()

        public void Draw(SpriteBatch spriteBatch)

            spriteBatch.Draw(Pl1Tex, new Rectangle((int)ConvertUnits.ToDisplayUnits(Pl1.Position.X), (int)ConvertUnits.ToDisplayUnits(Pl1.Position.Y), Pl1Tex.Width, Pl1Tex.Height), Color.White);