2
\$\begingroup\$

I am creating a 2D Vectorial (made of polygons, not tiles !) platformer using MonoGame and Farseer Physics Engine. Everything works perfectly, except the movement of the character which doesn't feels right for a platformer, because Farseer is a physics engine... I would like to have any advice to achieve a natural feeling -like Mario-. I didn't choose to make my own system because I'm simply not good enough to do something like this.

I've seen some questions already about it, but none had useful answers (they said like 'You have to do a lot of tweaking', but how do I do that exactly ?)

I could eventually use another engine that works for collision detection/response and that gives me more control over the player/entities, but i didn't find any yet. If you know any solution that's simple to use and that corresponds to what I need, then i'd love to hear it :)

Thank you for any help.

PS: Also, I am soon going to try to create AIs for my game. How would I make them move with great control (like the player) ?

\$\endgroup\$
  • \$\begingroup\$ Your best bet is to open the Farseer demos and study them. They show a lot of things and it will show you exactly how to do stuff. Farseer is basically Box2D for C#. There is almost nothing you can't do. Its a huge library. \$\endgroup\$ – dimitris93 Jun 30 '15 at 13:21
  • \$\begingroup\$ Please add a video or something. "Does not feel natural" is really hard to communicate via text. I would not think that Mario is natural: they sure have tweak Earth's gravity because that's not how high a human can jump, and that's not that fast a body falls down. \$\endgroup\$ – Vaillancourt Jun 30 '15 at 13:21
  • \$\begingroup\$ ...and to note that Mario does not use a physics engine. Resource worth checking out: higherorderfun.com/blog/2012/05/20/… \$\endgroup\$ – Felsir Feb 15 '16 at 9:14
1
\$\begingroup\$

I would control it all myself if I were you. Start with a float and a vector2 and from there create the 2D physics yourself.

vector2 pos = (100, 100)
float jump = 0; //this is the vertical momentum
protected override void Update(GameTime gameTime)
    {
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            Exit();

        if(Gamepad.GetState().IsKeyDown(Keys.Space))
        {
            jump = -10; //upwards jump of 10
        }
        pos.Y += jump;

        base.Update(gameTime);
    }

Now just draw the sprite at pos.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.