parralax background, two terrains, collectible coin, some graphics, physics layer
This commit is contained in:
1 parent
a7e18c2689
commit
c2f329ac60
20 files changed
+753
-24
No files matched your search
@@ -0,0 +1,17 @@
|
||||
class_name Coin extends Area2D
|
||||
|
||||
signal coinCollectedSignal(body, coin)
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
print("coin sees collision")
|
||||
coinCollectedSignal.emit(body, self)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cl87sslvg52qg
|
||||
@@ -1,5 +1,6 @@
|
||||
extends Node2D
|
||||
|
||||
var totalCoinsAvailable
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
@@ -18,3 +19,10 @@ func _on_areatrigger(effect, body) -> void:
|
||||
body.queue_free()
|
||||
if effect == "powerup":
|
||||
print("Power up the player")
|
||||
|
||||
func totalCoinCount(totalCoins):
|
||||
print("GC knows total coins"+str(totalCoins) )
|
||||
totalCoinsAvailable = totalCoins
|
||||
func coinCollected(body, coin):
|
||||
print("GC knows coin collected")
|
||||
coin.queue_free()
|
||||
@@ -5,10 +5,18 @@ var bulletArray =[]
|
||||
var totalAllowedBullets = 7
|
||||
@onready var triggers: Node2D = $"../Triggers"
|
||||
@onready var gameController: Node2D = $".."
|
||||
@onready var coins: Node2D = $"../Coins"
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
for obj in triggers.get_children():
|
||||
obj.areatrigger.connect(gameController._on_areatrigger)
|
||||
var coinCount = 0
|
||||
for obj in coins.get_children():
|
||||
obj.coinCollectedSignal.connect(gameController.coinCollected)
|
||||
coinCount +=1
|
||||
#send information to the game controller
|
||||
gameController.totalCoinCount(coinCount)
|
||||
|
||||
#makes bullets
|
||||
func bulletFactory():
|
||||
|
||||
Reference in new issue
Block a user