Hi, I want to remake this (rather fantastic) game:

I think i got everything else sorted, but I am totally stumped on the actual physics of the air-planes. How should I make it so the planes stall when there's not enough speed and take off when there's enough speed ? If anyone sees mercy on me and posts some code for this i would very grateful - thanks!

Are you asking about takeoff and stall behavior for airplanes, or how to animate an airplane sprite?

Hi Dave, thank you for the reply.
I'm asking how to get the plane to behave similar to the ones in the video above when controlled - I have some (albeit limited) experience with 'all other aspects' such as animation etc.

I'm trying to get the plane to rev the engine and pick up speed when 'ui_up' is pressed and then to move forward and to take off when some speed limit is reached - and to stall when speed is too low for the angle etc.

For now i have this for the control/behaviour of the plane (totally not behaving as I want to) - Perhaps this requires a lot more than I imagine :

extends KinematicBody2D

export (int) var speed = 500
export (float) var rotation_speed = 1.5
export (float) var friction = 0.65
var velocity = Vector2()
var rotation_dir = 0
var acc = Vector2()

func _ready():
	pass

func _physics_process(delta):
	rotation_dir = 0
	if Input.is_action_pressed('ui_right'):
		rotation_dir += 3
	if Input.is_action_pressed('ui_left'):
		rotation_dir -= 3
	if Input.is_action_pressed('ui_up'):
		acc = Vector2(0, -speed).rotated(rotation)
	elif Input.is_action_pressed('ui_down'):
		acc = Vector2(0, speed).rotated(rotation)
	else:
		acc = Vector2(0, 0)
	velocity += acc * delta
	rotation += rotation_dir * rotation_speed * delta
	move_and_slide(velocity, Vector2(0, 0))
	velocity = velocity.linear_interpolate(Vector2(0,0), friction * delta)

I've found this 2d-plane example (using a Rigidbody2d): https://github.com/leopnt/Godot-2D-plane-model But I'm leaning toward that this is too simulation-overkill and detrimental to a more 'arcade feel' to the controls.

Personally, I would start with that completed game (assuming it works). If it has features that are overkill for my use-case, I would gradually remove them.

I thinks that's a lot easier than writing airplane-simulation code from scratch.

Thanks again Dave. Well, the working part is the problem - that 2d plane model on Github is not exactly working for this use case (flying up side down is not part of the simulation, but necessary for the 'biplanes-remake' .

I did find out that someone else did ask my exact question last year: https://godotengine.org/qa/60303/help-with-2d-flight-physics

If anyone has more insights into how this is done code wise I'll be grateful.

2 years later