Compare commits
2 commits
flappy_bir
...
master
Author | SHA1 | Date | |
---|---|---|---|
986d02963a | |||
bb61699984 |
1 changed files with 10 additions and 11 deletions
|
@ -30,35 +30,35 @@ func _ready():
|
|||
func _process(_delta):
|
||||
# Every frame we want to move the bird
|
||||
# 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
|
||||
# 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.
|
||||
|
||||
|
||||
# Check if space is pressed
|
||||
if Input.is_action_just_pressed("ui_accept"):
|
||||
# Player pressed space -> Move the bird up
|
||||
# Space is pressed, change the y speed so it gains height
|
||||
# TODO 1
|
||||
|
||||
|
||||
# When we're not playing and space is hit then the game starts -> emit the right signal
|
||||
# TODO 2
|
||||
pass # remove this pass if you implement the todo's
|
||||
|
||||
|
||||
# Potential space are handled
|
||||
# Decrease the y speed
|
||||
# Decrease the y speed
|
||||
# TODO 1
|
||||
|
||||
|
||||
# Emit signal when a pipe is passed
|
||||
# TODO 3
|
||||
|
||||
|
||||
# Update the position with the new x and y speed
|
||||
position += Vector2(speed, speed_y * speed)
|
||||
|
||||
|
||||
# Rotate the bird
|
||||
update_rotation()
|
||||
|
||||
# Rotate the bird
|
||||
# Rotate the bird
|
||||
func update_rotation():
|
||||
rotation = atan(speed_y / speed)
|
||||
|
||||
|
@ -68,5 +68,4 @@ func update_rotation():
|
|||
func _on_Player_body_entered(_body):
|
||||
# Set the right variables and emit the right signals so the game restarts
|
||||
# TODO 2
|
||||
|
||||
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue