Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Mostafa Saeed |
this is the script
extends RigidBody2D
export var FLAP_FORCE = -200
const MAX_ROTATION_DEGREES = -30.0
onready var animator = $AnimationPlayer
var started = false
warning-ignore:unused_argument
func _physics_process(delta):
if Input.is_action_just_pressed(“flap”):
if !started:
start()
flap()
if rotation_degrees <= MAX_ROTATION_DEGREES:
angular_velocity = 0
rotation_degrees = MAX_ROTATION_DEGREES #the error is here
func start():
if started : return
started = true
gravity_scale = 5.0
animator.play(“Flap”)
func flap():
linear_velocity.y = FLAP_FORCE
angular_velocity = -8
As the error states, you have an indention problem in your code. Unfortunately, that’s impossible for anyone to find in the code you posted as it’s not formatted for the forum.
jgodfrey | 2022-10-13 22:02