Invader can no longer shoot itself (hopefully)

This commit is contained in:
Rain Clark 2024-05-16 13:43:51 -04:00
parent fed245fee2
commit 0b22409369
2 changed files with 29 additions and 28 deletions

View File

@ -35,6 +35,33 @@ shader_parameter/strength = 1.0
shader_parameter/noise_tex_normal = SubResource("NoiseTexture2D_vfidg") shader_parameter/noise_tex_normal = SubResource("NoiseTexture2D_vfidg")
shader_parameter/noise_tex = SubResource("NoiseTexture2D_ca84o") shader_parameter/noise_tex = SubResource("NoiseTexture2D_ca84o")
[sub_resource type="Animation" id="Animation_cojig"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("CrashSound:playing")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite2D:material:shader_parameter/progress")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [null]
}
[sub_resource type="Animation" id="Animation_l62j8"] [sub_resource type="Animation" id="Animation_l62j8"]
resource_name = "crash" resource_name = "crash"
length = 0.4 length = 0.4
@ -80,33 +107,6 @@ tracks/2/keys = {
"values": [null, 0.33, 0.66, 1.0] "values": [null, 0.33, 0.66, 1.0]
} }
[sub_resource type="Animation" id="Animation_cojig"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("CrashSound:playing")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite2D:material:shader_parameter/progress")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [null]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_1dk2o"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_1dk2o"]
_data = { _data = {
"RESET": SubResource("Animation_cojig"), "RESET": SubResource("Animation_cojig"),

View File

@ -32,7 +32,7 @@ func _process(delta: float) -> void:
if can_shoot: if can_shoot:
# FIXME: Proper shoot angle and not able to sudoku # FIXME: Proper shoot angle and not able to sudoku
shoot($GunMarker.global_position, randf_range(90.0, 100.0)) shoot($GunMarker.global_position, randf_range(90.0, 92.0))
# "Die", if off screen # "Die", if off screen
if position.x > viewport_size.x or position.x < 0: if position.x > viewport_size.x or position.x < 0:
@ -54,6 +54,7 @@ func shoot(pos : Vector2, rot : float) -> void:
var bullet := BULLET.instantiate() var bullet := BULLET.instantiate()
bullet.position = pos bullet.position = pos
bullet.rotation = rot bullet.rotation = rot
bullet.life_span = 0.3
$Projectiles.add_child(bullet) $Projectiles.add_child(bullet)
$ShootSound.play() $ShootSound.play()
can_shoot = false can_shoot = false