finishing rockets
This commit is contained in:
parent
4eb6966ef1
commit
5fb367e082
@ -6,6 +6,8 @@
|
|||||||
size = Vector2(12, 4)
|
size = Vector2(12, 4)
|
||||||
|
|
||||||
[node name="Rocket" type="RigidBody2D" unique_id=2026133878]
|
[node name="Rocket" type="RigidBody2D" unique_id=2026133878]
|
||||||
|
contact_monitor = true
|
||||||
|
max_contacts_reported = 2
|
||||||
script = ExtResource("1_3341w")
|
script = ExtResource("1_3341w")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1980926328]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1980926328]
|
||||||
|
|||||||
@ -49,3 +49,7 @@ func crateTotal(howmany):
|
|||||||
func bulletDamage(body, _bullet)->void:
|
func bulletDamage(body, _bullet)->void:
|
||||||
if body.is_in_group("shootable"):
|
if body.is_in_group("shootable"):
|
||||||
destroySignal.emit(body)
|
destroySignal.emit(body)
|
||||||
|
func rocketDamage(body, rocket)->void:
|
||||||
|
if body.is_in_group("shootable"):
|
||||||
|
print("Rocket strikes target!")
|
||||||
|
destroySignal.emit(body)
|
||||||
|
|||||||
@ -92,5 +92,6 @@ func makeRocket(spawnPosition, direction, speed)->void:
|
|||||||
print("make a rocket")
|
print("make a rocket")
|
||||||
var myRocket:Rocket = rocketFactory()
|
var myRocket:Rocket = rocketFactory()
|
||||||
myRocket.splodeSignal.connect(destroy)
|
myRocket.splodeSignal.connect(destroy)
|
||||||
|
myRocket.impactSignal.connect(game.rocketDamage)
|
||||||
myRocket.transform = spawnPosition
|
myRocket.transform = spawnPosition
|
||||||
pushTarget(myRocket,direction*speed)
|
pushTarget(myRocket,direction*speed)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user