diff options
| author | freddie-a <57713959+freddie-a@users.noreply.github.com> | 2022-10-30 03:30:47 +0000 |
|---|---|---|
| committer | freddie-a <57713959+freddie-a@users.noreply.github.com> | 2022-10-30 03:30:47 +0000 |
| commit | 34b97ea823b1627eac2b91825cd1a748d87afd60 (patch) | |
| tree | 6fc8a22fee383e46b56099134f1fc2844aa35b15 /Bullet.gd | |
| parent | 61fe177dc7ed9f0f667fc28b85cc68ce166e3410 (diff) | |
Add coin scoring
Diffstat (limited to 'Bullet.gd')
| -rw-r--r-- | Bullet.gd | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -3,7 +3,7 @@ export (int) var speed = 2000 var velocity = Vector2() var target = Vector2.ZERO -#var player = load("") +var spawn_object = load("res://Coin.tscn") var shot = false; var screen_size @@ -17,7 +17,10 @@ func _physics_process(delta): velocity = move_and_slide(velocity) for i in get_slide_count(): var collision = get_slide_collision(i) - if collision.collider and "Enemy" in collision.collider.get_name(): + if collision.collider: + var obj = spawn_object.instance() + obj.position = collision.collider.position + get_parent().add_child(obj) collision.collider.free() if velocity == Vector2(0.0, 0.0): queue_free() |
