forked from team-sg/hero-mark-2
add oxygen timer
This commit is contained in:
parent
fd218d6b13
commit
e6a393c5e2
22 changed files with 314 additions and 13 deletions
|
@ -15,8 +15,10 @@ func _physics_process(delta):
|
|||
sprite.position.x = sin(lifetime * 4.0) * 4.0
|
||||
position.y -= speed * delta
|
||||
|
||||
func _on_area_entered(area):
|
||||
if area.is_in_group("player_hitbox") or area.is_in_group("arrow"):
|
||||
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):
|
||||
sprite.frame_coords.y = 1
|
||||
speed = 0.0
|
||||
get_tree().create_timer(0.5, false).connect("timeout", self, "queue_free")
|
||||
if body.is_in_group("player"):
|
||||
body.oxygen_timer.start()
|
||||
Audio.play_sound(Audio.a_bubble,Audio.ac_die)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
[ext_resource path="res://objects/environment/bubble/bubble.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 2, 2 )
|
||||
extents = Vector2( 5, 5 )
|
||||
|
||||
[node name="Bubble" type="Area2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
@ -18,3 +18,4 @@ vframes = 2
|
|||
shape = SubResource( 1 )
|
||||
|
||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||
[connection signal="body_entered" from="." to="." method="_on_Bubble_body_entered"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue