parralax background, two terrains, collectable coin, some graphics, physics layer

This commit is contained in:
GabriellePipo committed 2025-06-23 21:04:19 -04:00
1 parent 327228717c
commit d549f68f30
20 files changed
+745 -5

No files matched your search

+17
View File
@@ -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)
+1
View File
@@ -0,0 +1 @@
uid://5xeni5cm0285
+8
View File
@@ -1,6 +1,7 @@
extends Node2D
var totalCoinsAvailable = 0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
@@ -19,3 +20,10 @@ func _on_areatrigger(effect, body) -> void:
if effect == "powerup":
print("power up the player")
func totalCoinCount(totalCoins):
print("GC knows coin total"+str(totalCoins) )
totalCoinsAvailable = totalCoins
func coinCollected(body, coin):
print("GC knows coin collected")
coin.queue_free()
+7
View File
@@ -6,10 +6,17 @@ 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 game controller
gameController.totalCoinCount(coinCount)
#makes bullets
func bulletFactory():
var mybullet