paralax, coin, tile set

This commit is contained in:
LucasLeaheySchofield committed 2025-08-25 21:11:19 -04:00
1 parent 81ae9e63e5
commit eab53ae648
27 files changed
+828 -32

No files matched your search

+8
View File
@@ -1,4 +1,7 @@
class_name Bullet extends Area2D
@onready var bulletgraphic = $bulletgraphic
var speed:float = 700
signal bulletDamageSignal(body, bullet)
@@ -6,6 +9,11 @@ signal bulletDamageSignal(body, bullet)
func setSpeed(value:float):
speed = value
if value<0:
bulletgraphic.flip_h = true
if value<0:
bulletgraphic.flip_h = false
func _physics_process(delta:float) -> void:
position += transform.x * speed * delta
+3
View File
@@ -25,3 +25,6 @@ func _on_trigger(effect: Variant, body: Variant) -> void:
func bulletDamage(body, bullet):
print("GC knows about bullet hit")
body.queue_free()
func coinCollected(body, coin):
print ("GC knows coin collected")
+5 -1
View File
@@ -4,6 +4,7 @@ var totalAllowedBullets = 7
var bullet = preload("res://Scenes/bullet.tscn")
@onready var game: Node2D = $".."
@onready var triggers = $"../triggers"
@onready var coins = $"../coins"
# Called when the node enters the scene tree for the first time.
@@ -12,8 +13,11 @@ func _ready() -> void:
for obj in triggers.get_children():
if obj is Trigger:
obj.areaTriggerSignal.connect(game._on_trigger)
if coins:
for obj in coins.get_children():
if obj is Coin:
obj.coinCollectedSignal.connect(game.coinCollected)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void: