2d movement

So i wanted to make a 2d platformer but for now i am struggling with the character movement. Can someone give me a way to move a character with scripts? I tried Rigidbody2d.Moveposition and .velocity but with them the gravity isn’t working.
The character need to collide with tile map elements and have to both vertically and horizontally. I dont need the complete code , i just need the method.

I just edited this to remove the incorrect link I supplied earlier.

There are several 2D platformers on the asset store. Just type 2D in the asset store search field and see what comes up.

There are plenty of complete Unity 2D platformer tutorials out there with lots of different approaches to handling collision, movement, animation, etc.

Thank you!
But could you recommend me a concrete method that i can use.

I’m not trying to be elusive. The method you choose is ideally one that you a) understand, and b) gives you the desired outcome. Necessarily that is not something I can know in advance, since it is your game design.

For instance, the approach used by Sonic The Hedgehog games and the approach used in Mario World are completely and utterly different. Until you start engineering and trying out some of the many available tutorials, you won’t really know what you’re looking for.

Hop right in, the water’s fine. Select two tutorials, make two Unity projects, and work through each tutorial. Ideally that should take no more than an hour or two for each one, and you will a) learn a ton about what is involved, and b) begin to develop and understanding of what you’re even looking to achieve.

Thank you for your honest answer.
If you have any more time for me could you recommend me a concrete tutorial? I already did brackeys.

Go to assets store and search: 2d platformer or you can go to Brackeys on YouTube search: 2d Movement Brackeys and follow the Video.

Enjoy and have fun :wink: