Following a tutorial and think I have done everything right but my bird is not going up when I press space

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Chemly

birdscript

extends RigidBody2D

onready var state = FlyingState

var Bird

func _ready():
set_process_input(true)
set_physics_process(true)
pass

func _fixed_process(delta):
state.update(delta)
pass

func _Input(event):
state.Input(event)
pass

Flying State -----------------------------------------------------------------------------------------

class FlyingState:

func _init():
	pass

func update(delta):
 	pass

func _input(event):
	if (event).if_action_pressed("Flap"):
		Flap()
		pass 
func exit():
pass

Flapping State -----------------------------------------------------------------------------------------

class FlappingState:

var Bird
func _init(Bird):
self.Bird = Bird 


Bird.set_linear_velocity(Vector2(0, Bird.get_linear_velocity().y))
pass

func update(delta):
if rad2deg(Bird.get_rot()) > 30:
Bird.set_rot(deg2rad(30))
Bird.set_angular_velocity()

if Bird.get_linear_velocity().y > 50:
    Bird.set_angular_velocity(1.5)
pass

func input(event):
if Input.is_action_pressed(“Flap”):
flap()
pass

func Flap():
set_linear_velocity(Vector2(get_linear_velocity().x, -150))
pass

func exit():
pass

HitState State -----------------------------------------------------------------------------------------

class HitState:

func _init():
	pass

func update(delta):
	pass

func input(event):
	pass 


func exit():
	pass

Ground State -----------------------------------------------------------------------------------------

class GroundState:

func _init():
	pass

func update(delta):
	pass

func input(event):
	pass 


func exit():
	pass
:bust_in_silhouette: Reply From: wombatstampede

It seems that you’ve used a tutorial for Godot 2.x. Which Godot version do you use?

_fixed_process(delta): has been renamed to _physics_process(delta): in Godot 3.x. And as soon as such a handler is defined it doesn’t have to be enabled (by setting to true) anmore. As well as the input handler. Your global input handler is misspelled _input(): or was that just lost in that formatting hell? (you wrote a capital I).

Any error messages in the debugger?

To see if a handler gets called just put a print("some text") in it and watch the output panel.

The problem now in the debugger is “Parser Error: Identifier not found: Bird”
and I also use Godot v3

Chemly | 2019-03-10 08:18

You are wanting that people help you but just throw tiny bits of information at them.

If I were Sherlock Holmes then I would probably love it. But not everybody is Sherlock and I know I put my magnifying glass somewhere but I can’t find it right now.

So here’s my findings so far:

You found a tutorial of 2016:
https://www.youtube.com/watch?v=k_ghOyPX820
EdwardAngeles / Godot Engine Tutorial - Flappy Bird / Downloads — Bitbucket

This tutorial is for Godot 2.x. If you want to run it on Godot 3.x then it has to be ported.

Here are some notes for porting from Godot 2.x to 3.x: (not always trivial)
GitHub - dploeger/godot-migrationnotes: Migration notes for Godot 2 => 3

About your error message. Normally, these error messages come with a file name and a line number. That would give us a hint actually where the error occured. Just saying…

So please post that script where that error is occuring and mark the line where it happened. The error message says: “You are using the term ‘Bird’ but have not declared a variabled ‘Bird’ and there’s also no global variable ‘Bird’ or a function parameter ‘Bird’”

wombatstampede | 2019-03-10 10:29