changed the way the fall sprite works
This commit is contained in:
parent
67e9a93b2b
commit
929b63c454
10 changed files with 179 additions and 42 deletions
|
@ -3,6 +3,7 @@ extends Area2D
|
|||
export var speed = 16.0
|
||||
|
||||
onready var sprite = $Sprite
|
||||
onready var activation_timer = $ActivationTimer
|
||||
|
||||
var lifetime = 0.0
|
||||
|
||||
|
@ -15,10 +16,16 @@ func _physics_process(delta):
|
|||
sprite.position.x = sin(lifetime * 4.0) * 4.0
|
||||
position.y -= speed * delta
|
||||
|
||||
func _on_Bubble_body_entered(body):
|
||||
func pop():
|
||||
sprite.frame_coords.y = 1
|
||||
speed = 0.0
|
||||
get_tree().create_timer(0.5, false).connect("timeout", self, "queue_free")
|
||||
|
||||
func _on_Bubble_body_entered(body):
|
||||
if body.is_in_group("player"):
|
||||
body.oxygen_timer.start()
|
||||
Audio.play_sound(Audio.a_bubble,Audio.ac_die)
|
||||
pop()
|
||||
elif activation_timer.time_left == 0:
|
||||
pop()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue