From 046b3450a7baf82bbe9dbc0a041f77bc45cf3e9c Mon Sep 17 00:00:00 2001 From: TimmyTuf Date: Mon, 20 Apr 2026 08:52:51 -0400 Subject: [PATCH] fixed tabbing, small type issues --- scripts/bullet.gd | 2 +- scripts/gameController.gd | 4 ++-- scripts/scene_manager.gd | 23 +++++++++++------------ 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/scripts/bullet.gd b/scripts/bullet.gd index b6f941e..b8ba0f7 100644 --- a/scripts/bullet.gd +++ b/scripts/bullet.gd @@ -8,7 +8,7 @@ signal bulletDamageSignal(body, bullet) func _ready() -> void: pass # Replace with function body. -func setSpeed(value)->void: +func setSpeed(value:int)->void: speed = value if speed <0: bullet_graphic.flip_h = true diff --git a/scripts/gameController.gd b/scripts/gameController.gd index dee64f5..337ccc7 100644 --- a/scripts/gameController.gd +++ b/scripts/gameController.gd @@ -44,8 +44,8 @@ func reset()->void: timeAvailable = timers[currentLevel] playerHealth = player.starting_health coinsCollected = 0 - - func secondCounter()->void: + +func secondCounter()->void: timeAvailable -=1 countDownSignal.emit(timeAvailable) if timeAvailable <=0: diff --git a/scripts/scene_manager.gd b/scripts/scene_manager.gd index dd971a9..f0f1cef 100644 --- a/scripts/scene_manager.gd +++ b/scripts/scene_manager.gd @@ -21,7 +21,7 @@ func _ready() -> void: # Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: +func _process(_delta: float) -> void: if Input.is_action_just_pressed("save"): print("Save the game!") if Input.is_action_just_pressed("load"): @@ -47,14 +47,13 @@ func buildLevel()->void: func updateEnemies()->void: if slimes: - var totalSlimes = 0 for obj in slimes.get_children(): if obj is Slime: - totalSlimes +=1 Gamecontroller.addEnemyToLevel(obj) #hook up to game controller if not obj.slimeDamageSignal.is_connected(Gamecontroller._on_slime_damage): obj.slimeDamageSignal.connect(Gamecontroller._on_slime_damage) + func updateCoins()->void: if coins: var totalCoins = 0 @@ -101,13 +100,14 @@ func teleport(body)->void: var newPosition = Vector2(random_x,random_y) body.teleport_to(newPosition) -func loadLevel(level:String)->void: - get_tree().call_deferred("change_scene_to_file", level) -func stashBullet(bullet:Bullet)->void: +func loadLevel(levelString:String)->void: + get_tree().call_deferred("change_scene_to_file", levelString) + +func stashBullet(bulletToStash:Bullet)->void: var stashPosition:Vector2 = Vector2(-100,100) - bullet.position = stashPosition - bullet.setSpeed(0) - bullet.set_process(false) + bulletToStash.position = stashPosition + bulletToStash.setSpeed(0) + bulletToStash.set_process(false) func bulletFactory()->Bullet : var myBullet:Bullet @@ -122,9 +122,8 @@ func bulletFactory()->Bullet : bulletArray.push_front(myBullet) return myBullet -func makeBullet(targetPosition, speed)->void: - print("Make a bullet!") - print("bullets created: "+str( bulletArray.size() )) + +func makeBullet(targetPosition:Transform2D, speed:int)->void: var myBullet:Bullet = bulletFactory() myBullet.transform = targetPosition myBullet.setSpeed(speed)