From f6ad5142bf31f55c5d1ba9f6a5369dde2cc93f3e Mon Sep 17 00:00:00 2001 From: Kevin O Gorman Date: Mon, 3 Feb 2025 21:03:41 -0500 Subject: [PATCH] added coins, bad guys --- assets/graphics/collectibles/coin.png | Bin 0 -> 500 bytes .../graphics/collectibles/coin.png.import | 8 +- assets/graphics/enemies/slime_purple.png | Bin 0 -> 1030 bytes .../graphics/enemies/slime_purple.png.import | 34 +++++ scenes/badguy.tscn | 75 +++++++++++ scenes/coin.tscn | 116 ++++++++++++++++++ scenes/game.tscn | 43 ++++--- scenes/level2.tscn | 19 ++- scenes/player.tscn | 4 +- scenes/trees.png | Bin 20749 -> 0 bytes scripts/badguy.gd | 32 +++++ scripts/coin.gd | 9 ++ scripts/gameController.gd | 29 ++++- scripts/res/characterStats.gd | 5 + scripts/res/playerstats.tres | 9 ++ scripts/res/slimestats.tres | 9 ++ scripts/sceneManager.gd | 20 ++- 17 files changed, 384 insertions(+), 28 deletions(-) create mode 100644 assets/graphics/collectibles/coin.png rename scenes/trees.png.import => assets/graphics/collectibles/coin.png.import (68%) create mode 100644 assets/graphics/enemies/slime_purple.png create mode 100644 assets/graphics/enemies/slime_purple.png.import create mode 100644 scenes/badguy.tscn create mode 100644 scenes/coin.tscn delete mode 100644 scenes/trees.png create mode 100644 scripts/badguy.gd create mode 100644 scripts/coin.gd create mode 100644 scripts/res/characterStats.gd create mode 100644 scripts/res/playerstats.tres create mode 100644 scripts/res/slimestats.tres diff --git a/assets/graphics/collectibles/coin.png b/assets/graphics/collectibles/coin.png new file mode 100644 index 0000000000000000000000000000000000000000..01ae33d70b398db7f1f7bcafe883a0a469805201 GIT binary patch literal 500 zcmV^r!6hi!Wct>kSmw76A*+mkqIDVjdDL!Rb}5E?Td;C@2y9S zHih2xK(yTWh+gXdrTqK8Uwx^_$MoI4V|67Hn26^Qp-rJ*c_3P5d_*tx|6%^yEznE& zeE6^KHvJ|vI7934d=L#ytZIR)9hxaN1Jm8sZ6_j{Yx1#nTWt!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{j5^S7Hg)J(CGxkt78LC}dT zuw6y`uoV(J8UVS|T~-wglGk}%AQb_i%K~<9Yttf6UCE)reo(lgRuh^)izOCHsN9=ur3(x*cP;2LIG|)>!qDajdu8&cf<6(qq4!M zYJfa)>J(7{nMt)UnW_1%h4onZ}D&QQcRP9?O*+h^}tVWl3~9joH;ZZ$ZC6f);-l45I}<69B0t6Sx8Z13@qf31BCHpn+@2);P8Ulb132 zjsd_Rwk2_HHO&O=M!ArqsBER%TqgI`=`cGH@B*40W*#|Fj%wC`6aXc^!H!}LwIg_% ztRa<(Ko}pl)$5S&r|SQ<2EdSIE?vbUj}-XAh{yE+S3OL$T{cdGfzNcTh!EkiZOs^{ zOiZfEbu1W$RRM|YN-;KW6n(CBZL8`ncf1I!V*&vHXfz>Fi)bwdi-s<~X7ty@a20~> zYm;NtAvM?t&>il;rZRFU4Uu7hD+<+!4zy*TX*(;h;b6F7uQ93CRm()Qvre#6!>c0n z$FoDQN!RdtSGe8{BOP>jQ`X)#Ee)zsG1RoS>)mhv9~w-DMH|Rx$p8QV07*qoM6N<$ Eg4K;VEdT%j diff --git a/scripts/badguy.gd b/scripts/badguy.gd new file mode 100644 index 0000000..45991ff --- /dev/null +++ b/scripts/badguy.gd @@ -0,0 +1,32 @@ +class_name BadGuy extends Area2D + +@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D +@onready var right_ray: RayCast2D = $RightRay +@onready var left_ray: RayCast2D = $LeftRay +@onready var right_floor_ray: RayCast2D = $RightFloorRay +@onready var left_floor_ray: RayCast2D = $LeftFloorRay + +const speed := 60 + +var direction = 1 + +signal playerHurt + +func _process(delta: float) -> void: + if not right_floor_ray.is_colliding(): + #about to fall off the right + direction = -1 + sprite.flip_h = not sprite.flip_h + if not left_floor_ray.is_colliding(): + #about to fall off the left + sprite.flip_h = not sprite.flip_h + direction = 1 + + position.x += direction*speed*delta + +func _on_body_entered(body: Node2D) -> void: + if body.is_in_group("player"): + print("player hurt") + playerHurt.emit() + # queue_free() + diff --git a/scripts/coin.gd b/scripts/coin.gd new file mode 100644 index 0000000..6f48b70 --- /dev/null +++ b/scripts/coin.gd @@ -0,0 +1,9 @@ +class_name Coin extends Area2D + +signal coinCollected + +func _on_body_entered(body: Node2D) -> void: + if body.is_in_group("player"): + coinCollected.emit() + queue_free() + diff --git a/scripts/gameController.gd b/scripts/gameController.gd index d315f9c..098f83b 100644 --- a/scripts/gameController.gd +++ b/scripts/gameController.gd @@ -3,11 +3,16 @@ extends Node2D var timer:= Timer.new() var secondCount= 99 var totalCrates := 0 +var totalCoins := 0 +var totalBadGuys := 0 +var totalCoinsCollected := 0 var cratesDestroyed := 0 +var player:Resource + # level info var levels = ["res://scenes/game.tscn", "res://scenes/level2.tscn"] -var timers = [20, 15] +var timers = [30, 30] var currentLevel = 0 #Gamecontroller signals @@ -16,6 +21,8 @@ signal levelComplete(leveltoLoad) # Called when the node enters the scene tree for the first time. func _ready() -> void: + player = load("res://scripts/res/playerstats.tres") + print("Player Health: "+str(player.health)) print("Number of levels: "+str(levels.size())) add_child(timer) timer.wait_time = 1 @@ -33,6 +40,17 @@ func secondCounter(): print("TIME IS UP") levelComplete.emit(levels[currentLevel]) +func playerDamaged(): + print("GC knows player took damage") + player.health = max(player.health-10, 0) + print("Player Health: "+str(player.health)) + + + +func coinCollected(): + totalCoinsCollected += 1 + print("DING! Coins collected: "+ str(totalCoinsCollected) ) + func bulletHit(body): print("Game controller knows bullet hit something") if body.is_in_group("destructables"): @@ -48,7 +66,14 @@ func bulletHit(body): levelComplete.emit(levels[currentLevel]) else: print("Crates Remaining: "+str(totalCrates) ) - + # Coming from scenemanager func countCrates(value): totalCrates = value + +func countCoins(value): + totalCoins = value + +func countBadGuys(value): + totalBadGuys = value + diff --git a/scripts/res/characterStats.gd b/scripts/res/characterStats.gd new file mode 100644 index 0000000..d10a15f --- /dev/null +++ b/scripts/res/characterStats.gd @@ -0,0 +1,5 @@ +class_name CharacterStats extends Resource + +@export var max_health:int = 100 +@export var starting_health:int = 100 +@export var health:int = 100 diff --git a/scripts/res/playerstats.tres b/scripts/res/playerstats.tres new file mode 100644 index 0000000..2fa2f55 --- /dev/null +++ b/scripts/res/playerstats.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" script_class="CharacterStats" load_steps=2 format=3 uid="uid://hdyv13v8yr88"] + +[ext_resource type="Script" path="res://scripts/res/characterStats.gd" id="1_d4qjr"] + +[resource] +script = ExtResource("1_d4qjr") +max_health = 150 +starting_health = 100 +health = 100 diff --git a/scripts/res/slimestats.tres b/scripts/res/slimestats.tres new file mode 100644 index 0000000..8260a9e --- /dev/null +++ b/scripts/res/slimestats.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" script_class="CharacterStats" load_steps=2 format=3 uid="uid://3vw8xffecvtj"] + +[ext_resource type="Script" path="res://scripts/res/characterStats.gd" id="1_74dik"] + +[resource] +script = ExtResource("1_74dik") +max_health = 60 +starting_health = 50 +health = 50 diff --git a/scripts/sceneManager.gd b/scripts/sceneManager.gd index 972e253..cc9dd55 100644 --- a/scripts/sceneManager.gd +++ b/scripts/sceneManager.gd @@ -2,21 +2,37 @@ extends Node # @onready var game: Node2D = $".." @onready var crates: Node2D = $"../crates" +@onready var coins: Node2D = $"../coins" +@onready var enemies: Node2D = $"../enemies" var theBullet = preload("res://scenes/bullet.tscn") var bulletArray:Array = [] -var totalCrates := 0 - # Called when the node enters the scene tree for the first time. func _ready() -> void: + var totalCrates = 0 GameController.reset() GameController.destroyBox.connect(boxDestroy) for obj in crates.get_children(): if obj.is_in_group("destructables"): totalCrates += 1 GameController.countCrates(totalCrates) + + var totalCoins = 0 + for obj in coins.get_children(): + if obj.is_in_group("collectibles"): + totalCoins += 1 + obj.coinCollected.connect(GameController.coinCollected) + GameController.countCoins(totalCoins) + var totalEnemies = 0 + for obj in enemies.get_children(): + if obj.is_in_group("enemies"): + totalEnemies += 1 + obj.playerHurt.connect(GameController.playerDamaged) + GameController.countBadGuys(totalEnemies) + + GameController.countCrates(totalCrates) # Subscribe to signals GameController.levelComplete.connect(changeLevel)