Compare commits

..

No commits in common. "master" and "flappy_bird" have entirely different histories.

View file

@ -30,35 +30,35 @@ func _ready():
func _process(_delta): func _process(_delta):
# Every frame we want to move the bird # Every frame we want to move the bird
# The player can influence the movement by pressing space # The player can influence the movement by pressing space
# An Area2D can have a position, split between x speed and y speed in a tuple # An Area2D can have a position, split between x speed and y speed in a tuple
# Right now we want to bird to move at a set pace so x is constant # Right now we want to bird to move at a set pace so x is constant
# It's up to you to change the y accordingly. # It's up to you to change the y accordingly.
# Check if space is pressed # Check if space is pressed
if Input.is_action_just_pressed("ui_accept"): if Input.is_action_just_pressed("ui_accept"):
# Player pressed space -> Move the bird up # Player pressed space -> Move the bird up
# Space is pressed, change the y speed so it gains height # Space is pressed, change the y speed so it gains height
# TODO 1 # TODO 1
# When we're not playing and space is hit then the game starts -> emit the right signal # When we're not playing and space is hit then the game starts -> emit the right signal
# TODO 2 # TODO 2
pass # remove this pass if you implement the todo's pass # remove this pass if you implement the todo's
# Potential space are handled # Potential space are handled
# Decrease the y speed # Decrease the y speed
# TODO 1 # TODO 1
# Emit signal when a pipe is passed # Emit signal when a pipe is passed
# TODO 3 # TODO 3
# Update the position with the new x and y speed # Update the position with the new x and y speed
position += Vector2(speed, speed_y * speed) position += Vector2(speed, speed_y * speed)
# Rotate the bird # Rotate the bird
update_rotation() update_rotation()
# Rotate the bird # Rotate the bird
func update_rotation(): func update_rotation():
rotation = atan(speed_y / speed) rotation = atan(speed_y / speed)
@ -68,4 +68,5 @@ func update_rotation():
func _on_Player_body_entered(_body): func _on_Player_body_entered(_body):
# Set the right variables and emit the right signals so the game restarts # Set the right variables and emit the right signals so the game restarts
# TODO 2 # TODO 2
pass