parralax background, two terrains, collectible coin, some graphics, physics layer
This commit is contained in:
1 parent
e01d74d89d
commit
05bb4ad9c0
20 files changed
+748
-8
No files matched your search
@@ -0,0 +1,16 @@
|
||||
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://cg6526ss1luok
|
||||
@@ -1,5 +1,6 @@
|
||||
extends Node2D
|
||||
|
||||
var totalCoinsAvailable =0
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
@@ -19,3 +20,10 @@ func _on_areatrigger(effect, body) -> void:
|
||||
|
||||
if effect == "powerup":
|
||||
print("power up the player")
|
||||
|
||||
func totalCoinCount(totalCoins):
|
||||
print("GC know total of 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 the info to gamecontroller
|
||||
gameController.totalCoinCount(coinCount)
|
||||
|
||||
|
||||
#makes bullets
|
||||
func bulletFactory():
|
||||
|
||||
Reference in new issue
Block a user