diff --git a/enemies/charging_car/charger_behavior.gd b/enemies/charging_car/charger_behavior.gd index 8972607..2caf72e 100644 --- a/enemies/charging_car/charger_behavior.gd +++ b/enemies/charging_car/charger_behavior.gd @@ -23,6 +23,7 @@ func _start_charge() -> void: enemy.velocity = global_position.direction_to(Player.instance.global_position) enemy.velocity *= CHARGE_SPEED enemy.set_rotation_to_velocity() + enemy.invulnerable = true func _end_charge() -> void: charge_clock = 0. @@ -30,6 +31,7 @@ func _end_charge() -> void: enemy.default_movement = true enemy.set_collision_mask_value(4, true) + enemy.invulnerable = false %KnockUpArea.monitoring = false %Meshes.position = Vector3.ZERO diff --git a/enemies/enemy.gd b/enemies/enemy.gd index f058c23..9136e81 100644 --- a/enemies/enemy.gd +++ b/enemies/enemy.gd @@ -7,6 +7,7 @@ const FRAME_IDXS := 10 @export var max_speed := 8. @export var health := 10. @export var knockback_mul := 1. +@export var invulnerable := false var frame_idx := 0 var frame_count := 0 @@ -57,6 +58,7 @@ func _process(delta: float) -> void: func hit(proj: Node3D, damage: float) -> bool: + if invulnerable: return true health -= damage if health <= 0: queue_free() diff --git a/player/player.gd b/player/player.gd index 0a17b42..2679b93 100644 --- a/player/player.gd +++ b/player/player.gd @@ -137,8 +137,12 @@ func _process(delta: float) -> void: damage_clock -= delta - if Input.is_action_just_pressed("swap_weapons"): - gun_index += 1 + if Input.is_action_just_pressed("sharpshooter"): + gun_index = 0 + if Input.is_action_just_pressed("minigun"): + gun_index = 1 + if Input.is_action_just_pressed("mortar"): + gun_index = 2 func damage(damager: Node3D) -> void: if health <= 0: return diff --git a/player/player.tscn b/player/player.tscn index 5afa143..84c91ba 100644 --- a/player/player.tscn +++ b/player/player.tscn @@ -38,7 +38,7 @@ collision_layer = 2 collision_mask = 13 script = ExtResource("1_4flbx") shake_noise = SubResource("FastNoiseLite_onrkg") -guns = [NodePath("Guns/BasicGun"), NodePath("Guns/MiniGun"), NodePath("Guns/Mortar")] +guns = [NodePath("Guns/Sharpshooter"), NodePath("Guns/MiniGun"), NodePath("Guns/Mortar")] [node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=204505475] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0) @@ -124,7 +124,7 @@ horizontal_alignment = 2 [node name="Guns" type="Node3D" parent="." unique_id=2018109083] -[node name="BasicGun" type="Node3D" parent="Guns" unique_id=1677055720] +[node name="Sharpshooter" type="Node3D" parent="Guns" unique_id=1677055720] unique_name_in_owner = true script = ExtResource("3_g1dw6") diff --git a/project.godot b/project.godot index 3b954b8..879c38c 100644 --- a/project.godot +++ b/project.godot @@ -66,16 +66,26 @@ dash={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) ] } -swap_weapons={ -"deadzone": 0.2, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) -] -} debug_menu={ "deadzone": 0.2, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":96,"key_label":0,"unicode":96,"location":0,"echo":false,"script":null) ] } +sharpshooter={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":49,"key_label":0,"unicode":49,"location":0,"echo":false,"script":null) +] +} +minigun={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":50,"key_label":0,"unicode":50,"location":0,"echo":false,"script":null) +] +} +mortar={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":51,"key_label":0,"unicode":51,"location":0,"echo":false,"script":null) +] +} [layer_names]