I wanted to make classic 2D platformer, but basic Godot approach on this doesn't seem to feet. Everything seems to be RigidBody oriented here, which isn't exactly what I would like to get. Classic games like Super Mario Bros, Castlevania or any other modern platformers like Super Meat Boy where made without usage of super powerfull physics engine. There is a lot of problems that has to be hacked if you want to make such game with collision shapes etc. To me it should be always tilebased etc. Is there anyone here who already tried to implement something similar in Godot? On one hand godot is promoted as the best engine for 2D games on the market, but on the other one, I don't know how to deal with it according to this classic and very common problem. Thanks in advance =]

Have you checked the "kinematic character" demo ?

As NeoD said, using a kinematic body is the way to go. You won't need to hack any physics stuff but you will have to deal with a lot of stuff by yourself (which i won't call 'hack' anyway). e.g. here's how I deal with movement of my player in a 8 direction 2d game (bird's eye perspective):

elif (compass == 6):
		velocity.x = velocity_value
		velocity.y = 0
		if (last_direction != compass ):
			anim.play("walking_right")
		last_direction = 6
		next_stopped_frame = 24

This is how I make the player walk to the right (compass standing for direction 6 for the key '6' of the numpad - just a personal way of mapping) the velocity stuff is self explanatory. The if checks the direction the player was pointing in the last frame in order to change the animation. last_direction = 6 will do the same for the next frame and, finally, next_stop_frame tells me in which frame the player should be if the input stops. Your player will collide with objects that have a collision shape but if you need something to happen (like the player taking a hit from a bullet) you will need to handle this collisions. In the same game I can interact with objects, so I use a raycasts to do so.

What I'm trying to say is that you will have to code stuff, but that's not hacking - call it "tunning" maybe :) Good luck!

Thank for help fokes. I was thinking exactly about The guide to implementing 2D platformers implementation. I don't like wonky physics in 2d platformers, since they should be precise as hell. I was hoping that somebody implemented it already in godot and could share some advices on this. I've made a platformer using kinematic characters 2 years ago in godot already for the first time, but I wasn't very pleased about the results. I felt like it was about "how to make godot work for me on this" almost all the time, not like "let's make it fun". In the end ( even after a lot of custom coded behaviours ) it was still wonky to me. On the other hand, I feel like it's the correct way, since there is a build in physics engine with a lot of ways of doing custom stuff out there ( including custom collisions shapes, collision detection, collision solving etc ). I feel like integer based actors position is a key here.

I'm confused.

The "physics engine" in this situation is really just a "collision engine", and it doesn't impose any restrictions on you. Kinematic bodies just give you a convenient way to check for collisions between two points. You can use an Area2D if you want, which will do nothing by itself and only give you collision results every fixed step. Obviously, if you don't want the engine to do anything for you, then you have to figure out everything yourself.

What exactly do you mean by "wonky"? If you're trying to make an object behave in physically-incorrect ways, that's wonky. Super Meatboy's mechanics for example, are extremely wonky. You stop moving upward the instant you release the jump key, giving you a weird cut-off arc like you ran into a ceiling. Likewise you stop moving on the ground instantly if you release all the keys, but you slide like crazy if you try to reverse direction. Extremely wonky.

What kind of platformer are you trying to make? You mentioned tile-based movement and "integer based actors position", which means something like Flashback of Prince of Persia, where you can only move in full tile increments. That's completely different from Mario or Meatboy, where you have continuous control and can stand overlapping tiles however you want.

[Edit] Also, for fairness's sake, most of this has nothing to do with Godot. Physics engines all work roughly the same way, and game engines are all pretty similar too.

Rect2 class have a function named "intersects" if you don't want any physic body.

Perhaps you are right Ross. Maybe it is wonky in some way, but it depends on the definition that you provide for that ;) When I was talking about integer base positions I was talking about solutions like TowerFall uses - so that the actual position of the character really is integer based - but there is a floating precission variable under the hood, that takes apart in calculations and updates the integer position. And I didn't mean "tile based like position" by that - which Prince Of Persia or any game of this genre was to me. Maybe you're right. Maybe I should give it a shot and try KinematicBody based character again. But to me that solution to too high-level in many ways.

6 days later

I don't have the answer to this but I'm also trying to find ways around a few things. I'm mostly trying to figure out how to make the player stick to the floor on slopes instead of flying off the hill-tops, and not speed up/slow down when going up or down slopes. I'm not that great with vectors, so it's being a challenge.

(I'm making my own script from scratch as I manage to understand the parts that make up the kinematic character script and others, and including what seems appropriate for what I want.)

6 years later