working rockets

This commit is contained in:
OddlyTimbot 2026-07-02 07:30:19 -04:00
parent 17a077d186
commit 4eb6966ef1
2 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,6 @@
class_name Rocket extends RigidBody2D
signal splodeSignal(rocket)
signal impactSignal(body, rocket)
func _ready() -> void:
#Rockets expolode in time
@ -12,6 +13,7 @@ func _ready() -> void:
func _on_body_entered(body: Node) -> void:
print("Rocket hit a target")
impactSignal.emit(body, self)
#should i splode myself? No. Scene manager job.
func splode()->void:

View File

@ -8,7 +8,7 @@ var rocket = preload("res://scenes/rocket.tscn")
var bulletArray:Array[Bullet] = []
var totalAllowedBullets:int = 7
var rocketArray:Array[Rocket] = []
var rocketDict:Dictionary = {}
var totalAllowedRockets:int = 3
# Called when the node enters the scene tree for the first time.
@ -82,6 +82,10 @@ func rocketFactory()->Rocket:
var myRocket:Rocket
myRocket = rocket.instantiate()
add_sibling(myRocket)
var rocketStat={
"damage": 10
}
rocketDict[myRocket]=rocketStat
return myRocket
func makeRocket(spawnPosition, direction, speed)->void: