explosive car; dash no longer stuns or gives extra fire rate
This commit is contained in:
parent
d0bfe8d1be
commit
5a7c93a573
7 changed files with 309 additions and 7 deletions
91
enemies/explosive_car/explosion.tscn
Normal file
91
enemies/explosive_car/explosion.tscn
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
[gd_scene format=3 uid="uid://bmp481gbe4vcx"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://br3jskryab3if" path="res://player/explosion/hit_area.gd" id="1_0tlud"]
|
||||||
|
|
||||||
|
[sub_resource type="SphereMesh" id="SphereMesh_5mksp"]
|
||||||
|
height = 0.5
|
||||||
|
radial_segments = 8
|
||||||
|
rings = 8
|
||||||
|
is_hemisphere = true
|
||||||
|
|
||||||
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_xpyis"]
|
||||||
|
transparency = 1
|
||||||
|
blend_mode = 1
|
||||||
|
shading_mode = 0
|
||||||
|
albedo_color = Color(1, 0, 0, 0.48235294)
|
||||||
|
|
||||||
|
[sub_resource type="SphereShape3D" id="SphereShape3D_xpyis"]
|
||||||
|
radius = 4.0949817
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_yr3g8"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Container:scale")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(1, 1, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_xpyis"]
|
||||||
|
resource_name = "explode"
|
||||||
|
length = 0.5
|
||||||
|
step = 0.5
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Container:scale")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.2, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0, 0, 0), Vector3(1, 1, 1), Vector3(0, 0, 0)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "method"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath(".")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0.5),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"values": [{
|
||||||
|
"args": [],
|
||||||
|
"method": &"queue_free"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_120gr"]
|
||||||
|
_data = {
|
||||||
|
&"RESET": SubResource("Animation_yr3g8"),
|
||||||
|
&"explode": SubResource("Animation_xpyis")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Explosion" type="Node3D" unique_id=702514359]
|
||||||
|
|
||||||
|
[node name="Container" type="Node3D" parent="." unique_id=1035655414]
|
||||||
|
|
||||||
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="Container" unique_id=509955843]
|
||||||
|
transform = Transform3D(7.6891003, 0, 0, 0, 7.6891003, 0, 0, 0, 7.6891003, 0, 0, 0)
|
||||||
|
mesh = SubResource("SphereMesh_5mksp")
|
||||||
|
surface_material_override/0 = SubResource("StandardMaterial3D_xpyis")
|
||||||
|
|
||||||
|
[node name="HitArea" type="Area3D" parent="Container" unique_id=468568433]
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 14
|
||||||
|
script = ExtResource("1_0tlud")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="Container/HitArea" unique_id=837356976]
|
||||||
|
shape = SubResource("SphereShape3D_xpyis")
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=893547695]
|
||||||
|
libraries/ = SubResource("AnimationLibrary_120gr")
|
||||||
|
autoplay = &"explode"
|
||||||
189
enemies/explosive_car/explosive_car.tscn
Normal file
189
enemies/explosive_car/explosive_car.tscn
Normal file
|
|
@ -0,0 +1,189 @@
|
||||||
|
[gd_scene format=3 uid="uid://q5cxluytck2h"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://oyqyvj5xo5mf" path="res://enemies/base_enemy.tscn" id="1_jdkrm"]
|
||||||
|
[ext_resource type="Script" uid="uid://btrksi0vamvst" path="res://enemies/explosive_car/explosive_car_behavior.gd" id="2_ofstr"]
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_jdkrm"]
|
||||||
|
size = Vector3(1.7734375, 0.5839844, 1.1367188)
|
||||||
|
|
||||||
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ofstr"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
albedo_color = Color(1, 0.22000003, 0.22000003, 1)
|
||||||
|
|
||||||
|
[sub_resource type="BoxMesh" id="BoxMesh_nf60p"]
|
||||||
|
size = Vector3(1, 0.25, 0.5)
|
||||||
|
|
||||||
|
[sub_resource type="BoxMesh" id="BoxMesh_vj2gi"]
|
||||||
|
size = Vector3(0.1, 0.05, 0.2)
|
||||||
|
|
||||||
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_1o86t"]
|
||||||
|
albedo_color = Color(1, 0.32, 0.32, 1)
|
||||||
|
|
||||||
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_q2pip"]
|
||||||
|
albedo_color = Color(0.26, 0.45733315, 1, 1)
|
||||||
|
|
||||||
|
[sub_resource type="CylinderMesh" id="CylinderMesh_6ocff"]
|
||||||
|
top_radius = 0.1
|
||||||
|
bottom_radius = 0.1
|
||||||
|
height = 0.5
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_ofstr"]
|
||||||
|
size = Vector3(1, 0.25, 0.5)
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_jdkrm"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Meshes/MeshInstance3D6:material_override:albedo_color")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 0.22000003, 0.22000003, 1)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath(".:max_speed")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [8.0]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Meshes:scale")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(1, 1, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_ofstr"]
|
||||||
|
resource_name = "explode"
|
||||||
|
step = 0.1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Meshes/MeshInstance3D6:material_override:albedo_color")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1),
|
||||||
|
"transitions": PackedFloat32Array(1.2745606, 2.0705302),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 0.22000003, 0.22000003, 1), Color(1, 0.6, 0.6, 1)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath(".:max_speed")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1),
|
||||||
|
"transitions": PackedFloat32Array(1.0000001, 0.46651652),
|
||||||
|
"update": 0,
|
||||||
|
"values": [8.0, 0.0]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Meshes:scale")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1),
|
||||||
|
"transitions": PackedFloat32Array(3.4822025, 0.24999988),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(1, 1, 1), Vector3(2, 2, 2)]
|
||||||
|
}
|
||||||
|
tracks/3/type = "method"
|
||||||
|
tracks/3/imported = false
|
||||||
|
tracks/3/enabled = true
|
||||||
|
tracks/3/path = NodePath("ExplosiveCarBehavior")
|
||||||
|
tracks/3/interp = 1
|
||||||
|
tracks/3/loop_wrap = true
|
||||||
|
tracks/3/keys = {
|
||||||
|
"times": PackedFloat32Array(1),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"values": [{
|
||||||
|
"args": [],
|
||||||
|
"method": &"_anim_explode"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_nf60p"]
|
||||||
|
_data = {
|
||||||
|
&"RESET": SubResource("Animation_jdkrm"),
|
||||||
|
&"explode": SubResource("Animation_ofstr")
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_nf60p"]
|
||||||
|
size = Vector3(11.374023, 1, 1)
|
||||||
|
|
||||||
|
[node name="ExplosiveCar" unique_id=206023291 instance=ExtResource("1_jdkrm")]
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="Hurtbox" parent_id_path=PackedInt32Array(688205599) index="0" unique_id=1284368855]
|
||||||
|
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -0.122092836, 0.34972915, -0.0012522953)
|
||||||
|
shape = SubResource("BoxShape3D_jdkrm")
|
||||||
|
debug_color = Color(0.9913104, 0, 0.27320355, 0.41960785)
|
||||||
|
|
||||||
|
[node name="Meshes" type="Node3D" parent="." index="2" unique_id=754389420]
|
||||||
|
|
||||||
|
[node name="MeshInstance3D6" type="MeshInstance3D" parent="Meshes" index="0" unique_id=394413961]
|
||||||
|
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -0.122092836, 0.34972915, -0.0012522953)
|
||||||
|
material_override = SubResource("StandardMaterial3D_ofstr")
|
||||||
|
mesh = SubResource("BoxMesh_nf60p")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D7" type="MeshInstance3D" parent="Meshes" index="1" unique_id=118317787]
|
||||||
|
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 0.59585166, 0.65602696, 0.24429089)
|
||||||
|
mesh = SubResource("BoxMesh_vj2gi")
|
||||||
|
surface_material_override/0 = SubResource("StandardMaterial3D_1o86t")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D8" type="MeshInstance3D" parent="Meshes" index="2" unique_id=2028775812]
|
||||||
|
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 0.60364604, 0.65602696, -0.23176795)
|
||||||
|
mesh = SubResource("BoxMesh_vj2gi")
|
||||||
|
surface_material_override/0 = SubResource("StandardMaterial3D_q2pip")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D9" type="MeshInstance3D" parent="Meshes" index="3" unique_id=1459550134]
|
||||||
|
transform = Transform3D(2, 0, 0, 0, -8.742278e-08, -2, 0, 2, -8.742278e-08, -0.8505253, -0.079150766, -0.0012522853)
|
||||||
|
material_override = SubResource("StandardMaterial3D_ofstr")
|
||||||
|
mesh = SubResource("CylinderMesh_6ocff")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D10" type="MeshInstance3D" parent="Meshes" index="4" unique_id=380519514]
|
||||||
|
transform = Transform3D(2, 0, 0, 0, -8.742278e-08, -2, 0, 2, -8.742278e-08, 0.62777025, -0.079150766, -0.0012522853)
|
||||||
|
material_override = SubResource("StandardMaterial3D_ofstr")
|
||||||
|
mesh = SubResource("CylinderMesh_6ocff")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="." index="3" unique_id=493184167]
|
||||||
|
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -0.122092836, 0.34972915, -0.0012522953)
|
||||||
|
shape = SubResource("BoxShape3D_ofstr")
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="4" unique_id=57061383]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
libraries/ = SubResource("AnimationLibrary_nf60p")
|
||||||
|
speed_scale = 2.0
|
||||||
|
|
||||||
|
[node name="ExplosiveCarBehavior" type="Node3D" parent="." index="5" unique_id=61397067]
|
||||||
|
script = ExtResource("2_ofstr")
|
||||||
|
|
||||||
|
[node name="Trigger" type="Area3D" parent="ExplosiveCarBehavior" index="0" unique_id=509352389]
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 2
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="ExplosiveCarBehavior/Trigger" index="0" unique_id=146579196]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.25, 0, 0)
|
||||||
|
shape = SubResource("BoxShape3D_nf60p")
|
||||||
|
|
||||||
|
[connection signal="body_entered" from="ExplosiveCarBehavior/Trigger" to="ExplosiveCarBehavior" method="_on_trigger_body_entered"]
|
||||||
18
enemies/explosive_car/explosive_car_behavior.gd
Normal file
18
enemies/explosive_car/explosive_car_behavior.gd
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
extends Node3D
|
||||||
|
|
||||||
|
var exploding := false
|
||||||
|
@onready var anim: AnimationPlayer = %AnimationPlayer
|
||||||
|
|
||||||
|
func _on_trigger_body_entered(_body: Node3D) -> void:
|
||||||
|
if exploding: return
|
||||||
|
anim.play("explode")
|
||||||
|
exploding = true
|
||||||
|
|
||||||
|
func _anim_explode() -> void:
|
||||||
|
var scene := preload("res://enemies/explosive_car/explosion.tscn")
|
||||||
|
var explosion: Node3D = scene.instantiate()
|
||||||
|
explosion.global_position = global_position
|
||||||
|
explosion.scale *= 3.
|
||||||
|
get_tree().current_scene.add_child(explosion)
|
||||||
|
queue_free()
|
||||||
|
|
||||||
1
enemies/explosive_car/explosive_car_behavior.gd.uid
Normal file
1
enemies/explosive_car/explosive_car_behavior.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://btrksi0vamvst
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -3,6 +3,8 @@ extends Area3D
|
||||||
func _on_collision(node: Node3D):
|
func _on_collision(node: Node3D):
|
||||||
if node.has_method("hit"):
|
if node.has_method("hit"):
|
||||||
node.hit(self, INF)
|
node.hit(self, INF)
|
||||||
|
if node.has_method("damage"):
|
||||||
|
node.damage(self)
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
body_entered.connect(_on_collision)
|
body_entered.connect(_on_collision)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ enum State {
|
||||||
}
|
}
|
||||||
|
|
||||||
const MOVE_SPEED := 7.5
|
const MOVE_SPEED := 7.5
|
||||||
const DASH_SPEED := 25.
|
const DASH_SPEED := 35.
|
||||||
const DASH_COST := .5
|
const DASH_COST := .5
|
||||||
|
|
||||||
static var instance: Player
|
static var instance: Player
|
||||||
|
|
@ -66,8 +66,8 @@ func _process_movement(delta: float) -> void:
|
||||||
dash_direction = input
|
dash_direction = input
|
||||||
state = State.DASHING
|
state = State.DASHING
|
||||||
await get_tree().create_timer(.25, false).timeout
|
await get_tree().create_timer(.25, false).timeout
|
||||||
state = State.LOCKED
|
# state = State.LOCKED
|
||||||
await get_tree().create_timer(.5, false).timeout
|
# await get_tree().create_timer(.5, false).timeout
|
||||||
state = State.NORMAL
|
state = State.NORMAL
|
||||||
|
|
||||||
func _process_dash() -> void:
|
func _process_dash() -> void:
|
||||||
|
|
@ -96,9 +96,9 @@ func _process_aim() -> void:
|
||||||
func _process_shoot(delta: float) -> void:
|
func _process_shoot(delta: float) -> void:
|
||||||
var clock_mul := 1.
|
var clock_mul := 1.
|
||||||
|
|
||||||
match state:
|
# match state:
|
||||||
State.DASHING: clock_mul = 2.5
|
# State.DASHING: clock_mul = 2.5
|
||||||
State.LOCKED: clock_mul = 2.5
|
# State.LOCKED: clock_mul = 2.5
|
||||||
|
|
||||||
gun.fire_clock -= delta * clock_mul
|
gun.fire_clock -= delta * clock_mul
|
||||||
if Input.is_action_pressed("fire") and gun.fire_clock <= 0.:
|
if Input.is_action_pressed("fire") and gun.fire_clock <= 0.:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue