Working with Jennie to adjust enemy identification in bullet.gd script
This commit is contained in:
parent
448009b6e4
commit
aae3238906
3 changed files with 47 additions and 31 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue