working rockets
This commit is contained in:
parent
17a077d186
commit
4eb6966ef1
@ -1,5 +1,6 @@
|
|||||||
class_name Rocket extends RigidBody2D
|
class_name Rocket extends RigidBody2D
|
||||||
signal splodeSignal(rocket)
|
signal splodeSignal(rocket)
|
||||||
|
signal impactSignal(body, rocket)
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
#Rockets expolode in time
|
#Rockets expolode in time
|
||||||
@ -12,6 +13,7 @@ func _ready() -> void:
|
|||||||
|
|
||||||
func _on_body_entered(body: Node) -> void:
|
func _on_body_entered(body: Node) -> void:
|
||||||
print("Rocket hit a target")
|
print("Rocket hit a target")
|
||||||
|
impactSignal.emit(body, self)
|
||||||
|
|
||||||
#should i splode myself? No. Scene manager job.
|
#should i splode myself? No. Scene manager job.
|
||||||
func splode()->void:
|
func splode()->void:
|
||||||
|
|||||||
@ -8,7 +8,7 @@ var rocket = preload("res://scenes/rocket.tscn")
|
|||||||
|
|
||||||
var bulletArray:Array[Bullet] = []
|
var bulletArray:Array[Bullet] = []
|
||||||
var totalAllowedBullets:int = 7
|
var totalAllowedBullets:int = 7
|
||||||
var rocketArray:Array[Rocket] = []
|
var rocketDict:Dictionary = {}
|
||||||
var totalAllowedRockets:int = 3
|
var totalAllowedRockets:int = 3
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
@ -82,6 +82,10 @@ func rocketFactory()->Rocket:
|
|||||||
var myRocket:Rocket
|
var myRocket:Rocket
|
||||||
myRocket = rocket.instantiate()
|
myRocket = rocket.instantiate()
|
||||||
add_sibling(myRocket)
|
add_sibling(myRocket)
|
||||||
|
var rocketStat={
|
||||||
|
"damage": 10
|
||||||
|
}
|
||||||
|
rocketDict[myRocket]=rocketStat
|
||||||
return myRocket
|
return myRocket
|
||||||
|
|
||||||
func makeRocket(spawnPosition, direction, speed)->void:
|
func makeRocket(spawnPosition, direction, speed)->void:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user