bullet hell test
This commit is contained in:
parent
52c5f20d3a
commit
92e138f163
5 changed files with 60 additions and 21 deletions
|
@ -1,9 +1,12 @@
|
|||
extends Area2D
|
||||
var velocity: Vector2 = Vector2()
|
||||
|
||||
var direction
|
||||
var speed = 100
|
||||
var btype
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
add_to_group(btype)
|
||||
#pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
@ -11,18 +14,28 @@ func _process(delta):
|
|||
pass
|
||||
|
||||
func _physics_process(delta):
|
||||
position += velocity * delta
|
||||
if direction == null:
|
||||
position += velocity * delta
|
||||
else:
|
||||
position += speed * delta * direction
|
||||
|
||||
|
||||
func _on_body_entered(body):
|
||||
if !body.is_in_group(btype):
|
||||
#if body.is_in_group("players"):
|
||||
# Global.live = 2
|
||||
#elif body.is_in_group("enemies"):
|
||||
# Global.live = 3
|
||||
#elif body.is_in_group("boss"):
|
||||
# Global.live = 3
|
||||
queue_free()
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_screen_exited():
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_area_entered(area):
|
||||
if !area.is_in_group(btype):
|
||||
queue_free()
|
||||
#pass # Replace with function body.
|
||||
|
|
|
@ -18,4 +18,5 @@ shape = SubResource("RectangleShape2D_g125y")
|
|||
|
||||
[node name="VisibleOnScreenEnabler2D" type="VisibleOnScreenEnabler2D" parent="."]
|
||||
|
||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue