From aae3238906698d56592403645aab204a26ce19b4 Mon Sep 17 00:00:00 2001 From: Henry Date: Sat, 28 Feb 2026 19:12:16 +0000 Subject: [PATCH] Working with Jennie to adjust enemy identification in bullet.gd script --- scenes/bullet.gd | 49 ++++++++++++++++++++----------------------- scenes/enemy_crt.tscn | 23 ++++++++++++++++++-- scenes/wave.gd | 6 +++--- 3 files changed, 47 insertions(+), 31 deletions(-) diff --git a/scenes/bullet.gd b/scenes/bullet.gd index c6664b9..e30c933 100644 --- a/scenes/bullet.gd +++ b/scenes/bullet.gd @@ -21,34 +21,31 @@ func _on_area_entered(area: Area2D) -> void: var enemies = get_tree().get_nodes_in_group("enemies") - for enemy in enemies: - match enemy.enemy_type: - "crt": - if area.is_in_group("enemies"): - print("CRT hit!") + #for enemy in enemies: + match enemies.enemy_type: + "crt": + if area.is_in_group("enemies"): + print("CRT hit!") + area.hit_detection() + queue_free() + + + "shards": + if area.is_in_group("shards"): + print("Shards hit!") + area.hit_detection() + + "mirror": + if area.is_in_group("enemies"): + print("Mirror hit!") + area.hit_detection() + queue_free() + + "chicken": + if area.is_in_group("enemies"): + print("Chicken hit!") area.hit_detection() queue_free() - - - "shards": - if area.is_in_group("shards"): - print("Shards hit!") - area.hit_detection() - - - - "mirror": - if area.is_in_group("enemies"): - print("Mirror hit!") - area.hit_detection() - queue_free() - - - "chicken": - if area.is_in_group("enemies"): - print("Chicken hit!") - area.hit_detection() - queue_free() #func bullet_fx(): #shader_active = true diff --git a/scenes/enemy_crt.tscn b/scenes/enemy_crt.tscn index 13d004b..197c032 100644 --- a/scenes/enemy_crt.tscn +++ b/scenes/enemy_crt.tscn @@ -2,13 +2,32 @@ [ext_resource type="Script" uid="uid://7ls7phfcupal" path="res://scenes/enemy_crt.gd" id="1_ugdur"] [ext_resource type="Texture2D" uid="uid://b5pswf7r8b7j4" path="res://sprites/crt.png" id="2_emiuq"] -[ext_resource type="Shader" uid="uid://dfywtah53il1m" path="res://shaders/player_hit.gdshader" id="2_gas3w"] [ext_resource type="Texture2D" uid="uid://cy4jggxmnohbb" path="res://sprites/chicken.png" id="2_ugdur"] [ext_resource type="Texture2D" uid="uid://bm7fgqwqfqmf4" path="res://sprites/explosion_pallete-swap.png" id="3_emiuq"] [ext_resource type="AudioStream" uid="uid://cbi5q575w1g1n" path="res://sounds/CRT_IMPACT.wav" id="6_gas3w"] +[sub_resource type="Shader" id="Shader_emiuq"] +code = "shader_type canvas_item; + +uniform float toggle; + +void vertex() { + // Called for every vertex the material is visible on. +} + +void fragment() { + COLOR = texture(TEXTURE, UV); + COLOR.r = mix(COLOR.r, abs(sin(TIME * 20.25)), toggle); +} + +//void light() { +// // Called for every pixel for every light affecting the CanvasItem. +// // Uncomment to replace the default light processing function with this one. +//} +" + [sub_resource type="ShaderMaterial" id="ShaderMaterial_gas3w"] -shader = ExtResource("2_gas3w") +shader = SubResource("Shader_emiuq") shader_parameter/toggle = 0.0 [sub_resource type="RectangleShape2D" id="RectangleShape2D_4gyqm"] diff --git a/scenes/wave.gd b/scenes/wave.gd index bf6a750..6fe0b79 100644 --- a/scenes/wave.gd +++ b/scenes/wave.gd @@ -24,7 +24,7 @@ func _ready(): func spawn_enemies(): - if wave_count == 2: #This is for CHICKENS + if wave_count == 0: #This is for CHICKENS print("Enemy Wave: ", wave_count) enemy = CHICKEN for x in range(COLS): @@ -37,7 +37,7 @@ func spawn_enemies(): await get_tree().process_frame print_debug("Remaining enemies: ", enemy_count, ", ", get_tree().get_nodes_in_group("enemies").size()) - if wave_count == 0: #This is for CRTs + if wave_count == 1: #This is for CRTs print("Enemy Wave: ", wave_count) enemy = CRT var cols_mod = COLS - 1 @@ -52,7 +52,7 @@ func spawn_enemies(): enemy_count = rows_mod * cols_mod await get_tree().process_frame - if wave_count == 1: #This if for Mirror + if wave_count == 2: #This if for Mirror print("Enemy Wave: ", wave_count) # Spawn Table