more finalboss workd

This commit is contained in:
Haze Weathers 2024-02-04 21:57:28 -05:00
parent 63b24cb614
commit 5b520f0a46
5 changed files with 87 additions and 26 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before After
Before After

View file

@ -4,19 +4,27 @@ extends Node2D
export var push_speed: float = 60.0 export var push_speed: float = 60.0
export var chase_speed: float = 40.0 export var chase_speed: float = 40.0
export var breath_dps: float = 50.0 export var breath_dps: float = 50.0
export var breath_knockback: float = 16.0
export var punch_damage: float = 10.0 export var punch_damage: float = 10.0
export var punch_knockback: float = 8.0
export var hurting: bool = false export var hurting: bool = false
export var sg2083_path: NodePath export var sg2083_path: NodePath
onready var animation_player: AnimationPlayer = $"%AnimationPlayer" onready var animation_player: AnimationPlayer = $"%AnimationPlayer"
onready var state_chart: Node = $StateChart onready var state_chart: StateChart = $StateChart
onready var in_range_cast: RayCast2D = $InRangeCast onready var in_range_cast: RayCast2D = $InRangeCast
onready var out_range_cast: RayCast2D = $OutRangeCast onready var out_range_cast: RayCast2D = $OutRangeCast
onready var shoot_range_cast: RayCast2D = $ShootRangeCast onready var shoot_range_cast: RayCast2D = $ShootRangeCast
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
var sg2083 := get_node(sg2083_path)
if sg2083 and sg2083.state == 0:
state_chart.set_guard_property("player_dead", true)
state_chart.send_event("player_dead")
else:
state_chart.set_guard_property("player_dead", false)
if not out_range_cast.is_colliding(): if not out_range_cast.is_colliding():
state_chart.send_event("out_of_range") state_chart.send_event("out_of_range")
elif in_range_cast.is_colliding(): elif in_range_cast.is_colliding():
@ -35,6 +43,7 @@ func _attack() -> void:
var sg2083 := get_node(sg2083_path) var sg2083 := get_node(sg2083_path)
if sg2083.has_method("hurt"): if sg2083.has_method("hurt"):
sg2083.hurt(punch_damage) sg2083.hurt(punch_damage)
sg2083.knock_back(punch_knockback)
func _on_Roar_state_entered() -> void: func _on_Roar_state_entered() -> void:
@ -85,3 +94,4 @@ func _on_Shooting_state_physics_processing(delta) -> void:
var distance := shoot_range_cast.to_local(shoot_range_cast.get_collision_point()).x var distance := shoot_range_cast.to_local(shoot_range_cast.get_collision_point()).x
var weight := inverse_lerp(shoot_range_cast.cast_to.x, 0.0, distance) var weight := inverse_lerp(shoot_range_cast.cast_to.x, 0.0, distance)
sg2083.hurt(breath_dps * weight * delta, true) sg2083.hurt(breath_dps * weight * delta, true)
sg2083.knock_back(breath_knockback * weight * delta)

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=25 format=2] [gd_scene load_steps=28 format=2]
[ext_resource path="res://objects/enemy/boss/famira.gd" type="Script" id=1] [ext_resource path="res://objects/enemy/boss/famira.gd" type="Script" id=1]
[ext_resource path="res://shaders/scale3x.gdshader" type="Shader" id=2] [ext_resource path="res://shaders/scale3x.gdshader" type="Shader" id=2]
@ -15,6 +15,10 @@
[ext_resource path="res://graphics/enemy/antlion_body.png" type="Texture" id=13] [ext_resource path="res://graphics/enemy/antlion_body.png" type="Texture" id=13]
[ext_resource path="res://graphics/enemy/tentacle.png" type="Texture" id=14] [ext_resource path="res://graphics/enemy/tentacle.png" type="Texture" id=14]
[ext_resource path="res://graphics/particles/dust.png" type="Texture" id=15] [ext_resource path="res://graphics/particles/dust.png" type="Texture" id=15]
[ext_resource path="res://shaders/1px_border.gdshader" type="Shader" id=16]
[sub_resource type="RectangleShape2D" id=11]
extents = Vector2( 28, 64 )
[sub_resource type="ShaderMaterial" id=1] [sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 2 ) shader = ExtResource( 2 )
@ -729,6 +733,7 @@ tracks/13/keys = {
[sub_resource type="Animation" id=3] [sub_resource type="Animation" id=3]
resource_name = "roar" resource_name = "roar"
length = 1.5 length = 1.5
loop = true
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/path = NodePath("Hip/Body:rotation_degrees") tracks/0/path = NodePath("Hip/Body:rotation_degrees")
tracks/0/interp = 1 tracks/0/interp = 1
@ -1086,6 +1091,11 @@ tracks/14/keys = {
"values": [ false, true, false ] "values": [ false, true, false ]
} }
[sub_resource type="ShaderMaterial" id=10]
shader = ExtResource( 16 )
shader_param/border_color = Color( 0, 0, 0, 1 )
shader_param/border_corners = false
[sub_resource type="Curve" id=8] [sub_resource type="Curve" id=8]
_data = [ Vector2( 0, 0.5 ), 0.0, 0.890696, 0, 0, Vector2( 0.814474, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), -13.2988, 0.0, 0, 0 ] _data = [ Vector2( 0, 0.5 ), 0.0, 0.890696, 0, 0, Vector2( 0.814474, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), -13.2988, 0.0, 0, 0 ]
@ -1099,6 +1109,14 @@ __meta__ = {
"_edit_vertical_guides_": [ ] "_edit_vertical_guides_": [ ]
} }
[node name="Hitbox" type="KinematicBody2D" parent="."]
collision_layer = 4
collision_mask = 0
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
position = Vector2( 12, -64 )
shape = SubResource( 11 )
[node name="ChickenMan" type="Node2D" parent="."] [node name="ChickenMan" type="Node2D" parent="."]
material = SubResource( 1 ) material = SubResource( 1 )
@ -1151,6 +1169,14 @@ offset = Vector2( 0, -6 )
region_enabled = true region_enabled = true
region_rect = Rect2( 0, 0, 16, 12 ) region_rect = Rect2( 0, 0, 16, 12 )
[node name="BackArmBorder" type="Node2D" parent="ChickenMan/Hip/Body/BackArm"]
show_behind_parent = true
material = SubResource( 10 )
script = ExtResource( 12 )
texture = ExtResource( 13 )
segments = 4
target = NodePath("../HandBack")
[node name="FrontArm" type="Node2D" parent="ChickenMan/Hip/Body"] [node name="FrontArm" type="Node2D" parent="ChickenMan/Hip/Body"]
use_parent_material = true use_parent_material = true
position = Vector2( -15.3626, -6.5891 ) position = Vector2( -15.3626, -6.5891 )
@ -1171,6 +1197,14 @@ offset = Vector2( 0, -6 )
region_enabled = true region_enabled = true
region_rect = Rect2( 0, 0, 16, 12 ) region_rect = Rect2( 0, 0, 16, 12 )
[node name="FrontArmBorder" type="Node2D" parent="ChickenMan/Hip/Body/FrontArm"]
show_behind_parent = true
material = SubResource( 10 )
script = ExtResource( 12 )
texture = ExtResource( 13 )
segments = 4
target = NodePath("../HandFront")
[node name="Neck" type="Sprite" parent="ChickenMan/Hip/Body"] [node name="Neck" type="Sprite" parent="ChickenMan/Hip/Body"]
show_behind_parent = true show_behind_parent = true
use_parent_material = true use_parent_material = true
@ -1256,6 +1290,11 @@ script = ExtResource( 6 )
to = NodePath("../PushedBack") to = NodePath("../PushedBack")
event = "start_push" event = "start_push"
[node name="On PlayerDead" type="Node" parent="StateChart/Root"]
script = ExtResource( 6 )
to = NodePath("../Roar")
event = "player_dead"
[node name="Roar" type="Node" parent="StateChart/Root"] [node name="Roar" type="Node" parent="StateChart/Root"]
script = ExtResource( 5 ) script = ExtResource( 5 )
@ -1263,6 +1302,7 @@ script = ExtResource( 5 )
script = ExtResource( 6 ) script = ExtResource( 6 )
to = NodePath("../../Chasing") to = NodePath("../../Chasing")
event = "roar_done" event = "roar_done"
guard_expression = "not player_dead"
[node name="Chasing" type="Node" parent="StateChart/Root"] [node name="Chasing" type="Node" parent="StateChart/Root"]
script = ExtResource( 5 ) script = ExtResource( 5 )
@ -1282,7 +1322,7 @@ script = ExtResource( 5 )
[node name="On OutOfRange" type="Node" parent="StateChart/Root/Punching"] [node name="On OutOfRange" type="Node" parent="StateChart/Root/Punching"]
script = ExtResource( 6 ) script = ExtResource( 6 )
to = NodePath("../../PunchCooldown") to = NodePath("../../Roar")
event = "out_of_range" event = "out_of_range"
[node name="PunchCooldown" type="Node" parent="StateChart/Root"] [node name="PunchCooldown" type="Node" parent="StateChart/Root"]
@ -1290,6 +1330,7 @@ script = ExtResource( 5 )
[node name="On Cooldown" type="Node" parent="StateChart/Root/PunchCooldown"] [node name="On Cooldown" type="Node" parent="StateChart/Root/PunchCooldown"]
script = ExtResource( 6 ) script = ExtResource( 6 )
to = NodePath("../../Roar")
delay = 0.5 delay = 0.5
[node name="Shooting" type="Node" parent="StateChart/Root"] [node name="Shooting" type="Node" parent="StateChart/Root"]

View file

@ -1,7 +1,7 @@
extends Node2D extends KinematicBody2D
enum State {STAND, FORWARD, BACK, DUCK, BEAM, DEAD} enum State {DEAD, STAND, FORWARD, BACK, DUCK, BEAM}
const Bullet = preload("res://objects/enemy/2600_bullet.tscn") const Bullet = preload("res://objects/enemy/2600_bullet.tscn")
const SmallExplosion = preload("res://objects/enemy/boss/2600_small_explosion.tscn") const SmallExplosion = preload("res://objects/enemy/boss/2600_small_explosion.tscn")
@ -17,6 +17,7 @@ export var famira_path: NodePath
var state: int = State.STAND var state: int = State.STAND
var knockback: float = 0.0
onready var bullet_positions = $"%BulletPositions" onready var bullet_positions = $"%BulletPositions"
@ -42,9 +43,11 @@ func _physics_process(delta: float) -> void:
if not Input.is_action_pressed("move_down") and anims.current_animation.empty(): if not Input.is_action_pressed("move_down") and anims.current_animation.empty():
anims.play("UnDuck") anims.play("UnDuck")
State.FORWARD: State.FORWARD:
position.x += move_speed * delta move_and_slide(Vector2(move_speed, 0.0))
State.BACK: State.BACK:
position.x -= move_speed * delta move_and_slide(Vector2(-move_speed, 0.0))
move_and_slide(Vector2(-knockback, 0.0))
knockback *= pow(0.1, delta)
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
@ -80,6 +83,10 @@ func hurt(amount: float, can_duck: bool = false) -> void:
anims.play("die") anims.play("die")
func knock_back(amount: float) -> void:
knockback += amount
func _play_laser_sound(play: bool): func _play_laser_sound(play: bool):
var famira = get_node(famira_path) var famira = get_node(famira_path)
if play: if play:

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=38 format=2] [gd_scene load_steps=39 format=2]
[ext_resource path="res://shaders/color_noise.gdshader" type="Shader" id=1] [ext_resource path="res://shaders/color_noise.gdshader" type="Shader" id=1]
[ext_resource path="res://graphics/enemy/boss/stg_2600/tailpipes.png" type="Texture" id=2] [ext_resource path="res://graphics/enemy/boss/stg_2600/tailpipes.png" type="Texture" id=2]
@ -20,6 +20,9 @@
[ext_resource path="res://graphics/fade_patterns/stg_explosion.png" type="Texture" id=18] [ext_resource path="res://graphics/fade_patterns/stg_explosion.png" type="Texture" id=18]
[ext_resource path="res://objects/enemy/boss/sg2083.gd" type="Script" id=19] [ext_resource path="res://objects/enemy/boss/sg2083.gd" type="Script" id=19]
[sub_resource type="RectangleShape2D" id=27]
extents = Vector2( 44, 76 )
[sub_resource type="Animation" id=4] [sub_resource type="Animation" id=4]
resource_name = "Beam" resource_name = "Beam"
length = 4.0 length = 4.0
@ -30,7 +33,7 @@ tracks/0/loop_wrap = true
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/keys = { tracks/0/keys = {
"times": PoolRealArray( 0, 1.6, 3.4 ), "times": PoolRealArray( 0, 1, 3.4 ),
"transitions": PoolRealArray( 1, 1, 1 ), "transitions": PoolRealArray( 1, 1, 1 ),
"values": [ { "values": [ {
"args": [ true ], "args": [ true ],
@ -50,7 +53,7 @@ tracks/1/loop_wrap = true
tracks/1/imported = false tracks/1/imported = false
tracks/1/enabled = true tracks/1/enabled = true
tracks/1/keys = { tracks/1/keys = {
"times": PoolRealArray( 0, 1.5, 1.6, 3.3, 3.4 ), "times": PoolRealArray( 0, 0.9, 1, 3.3, 3.4 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ), "transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
"update": 0, "update": 0,
"values": [ Vector2( 1, 1e-05 ), Vector2( 1, 1e-05 ), Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 1, 1e-05 ) ] "values": [ Vector2( 1, 1e-05 ), Vector2( 1, 1e-05 ), Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 1, 1e-05 ) ]
@ -62,10 +65,10 @@ tracks/2/loop_wrap = true
tracks/2/imported = false tracks/2/imported = false
tracks/2/enabled = true tracks/2/enabled = true
tracks/2/keys = { tracks/2/keys = {
"times": PoolRealArray( 0, 1.3, 1.5, 3.3, 3.4 ), "times": PoolRealArray( 0, 0.7, 3.3, 3.4 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ), "transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 0, "update": 0,
"values": [ Vector2( 1e-05, 1 ), Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 1, 1e-05 ) ] "values": [ Vector2( 1e-05, 1 ), Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 1, 1e-05 ) ]
} }
tracks/3/type = "value" tracks/3/type = "value"
tracks/3/path = NodePath("Axle/Head/Beam/Hitbox/BeamShape:disabled") tracks/3/path = NodePath("Axle/Head/Beam/Hitbox/BeamShape:disabled")
@ -74,7 +77,7 @@ tracks/3/loop_wrap = true
tracks/3/imported = false tracks/3/imported = false
tracks/3/enabled = true tracks/3/enabled = true
tracks/3/keys = { tracks/3/keys = {
"times": PoolRealArray( 0, 1.6, 3.4 ), "times": PoolRealArray( 0, 1, 3.4 ),
"transitions": PoolRealArray( 1, 1, 1 ), "transitions": PoolRealArray( 1, 1, 1 ),
"update": 1, "update": 1,
"values": [ true, false, true ] "values": [ true, false, true ]
@ -86,7 +89,7 @@ tracks/4/loop_wrap = true
tracks/4/imported = false tracks/4/imported = false
tracks/4/enabled = true tracks/4/enabled = true
tracks/4/keys = { tracks/4/keys = {
"times": PoolRealArray( 0, 1.1 ), "times": PoolRealArray( 0, 0.5 ),
"transitions": PoolRealArray( 1, 1 ), "transitions": PoolRealArray( 1, 1 ),
"update": 1, "update": 1,
"values": [ true, false ] "values": [ true, false ]
@ -182,7 +185,7 @@ tracks/12/loop_wrap = true
tracks/12/imported = false tracks/12/imported = false
tracks/12/enabled = true tracks/12/enabled = true
tracks/12/keys = { tracks/12/keys = {
"times": PoolRealArray( 0, 1.5, 3.4 ), "times": PoolRealArray( 0, 0.9, 3.4 ),
"transitions": PoolRealArray( 1, 1, 1 ), "transitions": PoolRealArray( 1, 1, 1 ),
"update": 1, "update": 1,
"values": [ false, true, false ] "values": [ false, true, false ]
@ -1291,18 +1294,19 @@ tracks/1/keys = {
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0.833333 ), Color( 1, 1, 1, 0.666667 ), Color( 1, 1, 1, 0.5 ), Color( 1, 1, 1, 0.333333 ), Color( 1, 1, 1, 0.166667 ), Color( 1, 1, 1, 0 ) ] "values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0.833333 ), Color( 1, 1, 1, 0.666667 ), Color( 1, 1, 1, 0.5 ), Color( 1, 1, 1, 0.333333 ), Color( 1, 1, 1, 0.166667 ), Color( 1, 1, 1, 0 ) ]
} }
[sub_resource type="RectangleShape2D" id=26] [sub_resource type="SegmentShape2D" id=26]
extents = Vector2( 42, 76 ) a = Vector2( 4, -76 )
b = Vector2( 4, 76 )
[node name="2083" type="Node2D"] [node name="2083" type="KinematicBody2D"]
z_index = 5 collision_mask = 5
script = ExtResource( 19 ) script = ExtResource( 19 )
__meta__ = {
"_edit_horizontal_guides_": [ 168.0, 128.0, 157.0 ],
"_edit_vertical_guides_": [ 88.0, 67.0, 21.0, 42.0, 79.0 ]
}
explosion_rect = Rect2( 24, 16, 88, 64 ) explosion_rect = Rect2( 24, 16, 88, 64 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 60, 92 )
shape = SubResource( 27 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
anims/Beam = SubResource( 4 ) anims/Beam = SubResource( 4 )
@ -1644,8 +1648,7 @@ collision_mask = 0
monitoring = false monitoring = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="DetectionBox"] [node name="CollisionShape2D" type="CollisionShape2D" parent="DetectionBox"]
position = Vector2( 62, 92 ) position = Vector2( 100, 92 )
shape = SubResource( 26 ) shape = SubResource( 26 )
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_finished"] [connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_finished"]
[connection signal="area_entered" from="Axle/Head/Beam/Hitbox" to="." method="_on_Hitbox_area_entered"]